mardi 28 mars 2017

How to check if a template function was specialized?

Is there a way to establish in compile time if a certain template function was specialized?

For example, assume the following function:

template<size_t N>
void foo();

I want to test if foo<42> was specialized. Note that the declaration above doesn't contain any default implementation.

I tried SFINAE but couldn't find a condition on the function that the compiler cannot deduce from its declaration.

Any thoughts?

Thanks

Aucun commentaire:

Enregistrer un commentaire