A meta-function is a function that applies to types. For example, you can define the meta-function AddPointer which skips the type int at "int*" like this:
Code:
struct AddPointer {
template<typename T>
struct apply {
typedef T* type;
};
};
int main() {
typedef AddPointer::apply<int>::type TPInt;
// And here TPInt is a pointer to int...
return 0;
}
Once in your sample before you took your arguments in a meta-function and a type to which you apply your meta-function. So you use it like this:
Code:
int main() {
AddPointer::apply<int>::type TPInt;
// and here TPInt is a pointer to int...
twice<AddPointer, int>::type TDPInt;
return 0;
}
So the syntax is that when you want to call a structure in a generic type F, you do F:: template apply (apply with your structure is in F). To access IT F:: apply
Bookmarks