SFINAEHelper< T, CHECK > Class Template Reference Data Types

#include <apibase.h>

详细描述

template<typename T, typename... CHECK>
class maxon::SFINAEHelper< T, CHECK >

This helper class can be used for two purposes: It allows to disable function templates based on the template arguments, and to defer the compiler's requirements for complete types to the template instantiation. An example of the first usage is:

template < typename T> typename SFINAEHelper<Int, typename T::IsForEachIterator>::type MyFunction( const T& object );

MyFunction will only be available for types T which have a member type IsForEachIterator, and its result type will be Int. An example of the second usage is:

class String ; template < typename T> typename SFINAEHelper<String, T>::type ToString ( const T& object ) { return object .ToString(); }

Without the SFINAEHelper , the compiler would complain that String is an incomplete type and as such cannot be used for the return type of a function definition, so you'd have to include the corresponding header file for String . With the SFINAEHelper , only when the ToString template function is actually instantiated String has to be a complete type, so it suffices to include the header file for String only where it is actually used.

Template Parameters
T Type used for the result.
CHECK Some types which are used for SFINAE on overload resolution.

Public Types

using  type = T
String
定义: c4d_string.h:38
maxon::ToString
String ToString(const String &str, const FormatStatement *formatStatement, Bool=false)
定义: string.h:1680
maxon::SFINAEHelper::type
T type
The result type will always be T.
定义: apibase.h:479