- Is it possible to write a concept to check for the existence of a member that is a template (without just trying an arbitrary specialization)?
For example, check if the type contains a function zug<T>(T)
taking a template parameter.
struct SNoZug {};
struct SZug
{
template <typename T> // (A)
void zug(T) {};
};
template <typename T>
concept has_zug = ???; // << CAN THIS BE DONE?
static_assert(!has_zug<SNoZug>);
static_assert(has_zug<SZug>);
- Can this be done if (A) uses a concept parameter (eg:
template <some_other_concept T>
)? - Can this be done if
zug
(A) uses a variadic parameter? - Can this be done if
zug
uses a value parameter? - Can this be done if
zug
uses an auto parameter? - Can this be done if
zug
uses a template template parameter? - Can this be done if
zug
was a member class instead of a member function?
NOTE: Related unanswered question: Check the existence of a member function template in a concept definition.
NOTE: There's some proposed code for a potentially related problem here, but I'm not sure if it's valid C++: C++20 Template Template Concept Syntax.