variadic templates problem
-
Im using this for the first time for mapping a function "f" with variable count of parameters declarition:
template void AllItemsO(void (*f)(A...), A... args)
{
// for (auto _F : *this)
// if ((_F)) ((_F)->*f)(args);
}call in cpp:
AllItemsO(&IcompDWO3D::SetObjMat, visInfo, pci, doit, obj);
function to call is: IcompDWO3D::SetObjMat parameters: visInfo, pci, doit, obj compiler always shows up an error C2784 Fehler 1 error C2784: "void CapDWOICollection::AllItemsO(void (__cdecl *)(A...),A...)": template-Argument für "void (__cdecl *)(IapVisibilityInfo *,IPickCookie *,aprivis::MakeSubObjSpecial,aprivis::avhObjectWrapper &,A...)" konnte nicht von "void (__thiscall component::IcompDWO3D::* )(IapVisibilityInfo *,IPickCookie *,aprivis::MakeSubObjSpecial,aprivis::avhObjectWrapper &)" hergeleitet werden. looking at what I have shown bold, it seems that it cannot spread the functionparameters form the A... variadic to single paarameters? A non variadic verison with 2 Parameters looks like this and works:
template void AllItemsO2(void (*f)(T1, T2), T1 p1, T2 p2)
{ for (auto _F : *this) if (_F) ((_F)->*f)(p1, p2); }any help for my syntax?