template<typename T, template< typename X > class C>
struct elm::meta::is_supported< T, C >
Type containing a value "_" which value is 1 if the template C can be applied to T, 0 else.
This type is useful to test if some property is available on a type T. It is commonly used, but not limited to, to test if a function is member of a type T
In the example below, the condition has_f tests if T contains a function named f taking an integer as first parameter:
template <class T>
using has_f = decltype(declval<T>().f(int(0)));
int main() {
MyClass o;
if(meta::is_supported<MyClass, has_f>())
o.f(666);
}
- Parameters
-
T | Type to test. |
C | Condition to test (template supporting one parameter). |