vendredi 3 avril 2020

How can I check if a default-deleted function template is deleted for a specific type?

Suppose I have the following non-constexpr function templates:

template <typename T> void foo() = delete;
template <typename T> void bar() = delete;

which has some explicit instantiation as an exception to the general-case deletion.

Now, given a specific (template parameter) type T, how can I detect, at compile-time, whether foo<T>() and bar<T>(), respectively, are instantiated? That is, other than saying: std::is_same<T,first_instantiated_type>::value or std::is_same<T,second_instantiated_type>::value or etc. etc.

Note: Looking for a C++11 solution.

Aucun commentaire:

Enregistrer un commentaire