lundi 7 décembre 2015

Can I give function pointer to template parameter?

Can I do something like this?

template<function_pointer_type pointer_name> struct structure1{
   //here I call pointer_name(0)
};

void* function1 = [&](int a) {
   return a * a;
}
structure1<function1> b;

I tried but it never compiled.

Aucun commentaire:

Enregistrer un commentaire