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>);
template <some_other_concept T>
)?zug
(A) uses a variadic parameter?zug
uses a value parameter?zug
uses an auto parameter?zug
uses a template template parameter?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.
You can check for .zug<int>(0)
being valid, or any fixed instantiation (including those that are functions of the other template arguments).
This will work the same as testing for .zug()
would.
You cannot check for a generic template without trying to instantiate.
It may be possible after reflection is added to C++ to do so.