SUNphi
1.0
|
Defines macros to enable or disable template instantiation. More...
#include <metaprogramming/TypeTraits.hpp>
Go to the source code of this file.
Macros | |
#define | SFINAE_ON_TEMPLATE_ARG(...) TypeIf<(__VA_ARGS__),void*> =nullptr |
#define | SFINAE_WORSEN_DEFAULT_VERSION_TEMPLATE_PARS typename...DummyTypes /* Fake list of types */ |
#define | SFINAE_WORSEN_DEFAULT_VERSION_ARGS DummyTypes... /*< Fake list of args */ |
Provide empty list of args, used to unprioritize default version. | |
#define | SFINAE_WORSEN_DEFAULT_VERSION_ARGS_CHECK STATIC_ASSERT_ARE_N_TYPES(0,DummyTypes) |
Check that no extra arg is passed. | |
#define | SFINAE_TEMPLATE_CLASS_SPECIALIZATION_PREAMBLE |
#define | SFINAE_TEMPLATE_CLASS_SPECIALIZATION_ARG(TYPE) EnableIfIs ## TYPE<TT<Ts...>,TT<Ts...>> |
To be used as an argument of the specialization. | |
#define | SFINAE_TEMPLATE_CLASS_SPECIALIZATION_PROVIDE_TYPE |
Provides the type inside the specialized class. More... | |
Defines macros to enable or disable template instantiation.
http://en.cppreference.com/w/cpp/language/sfinae
Definition in file SFINAE.hpp.
#define SFINAE_ON_TEMPLATE_ARG | ( | ... | ) | TypeIf<(__VA_ARGS__),void*> =nullptr |
Provides a SFINAE to be used in template par list
This follows https://stackoverflow.com/questions/32636275/sfinae-with-variadic-templates as in this example
Definition at line 24 of file SFINAE.hpp.
#define SFINAE_TEMPLATE_CLASS_SPECIALIZATION_PREAMBLE |
SFINAE for template class specialisation
Mechanism to allow the usage of SFINAE to allow a class specialization. Follows the advice of https://stackoverflow.com/a/30991097 to create a class providing the type itself
Example:
Definition at line 108 of file SFINAE.hpp.
#define SFINAE_TEMPLATE_CLASS_SPECIALIZATION_PROVIDE_TYPE |
Provides the type inside the specialized class.
Definition at line 117 of file SFINAE.hpp.
#define SFINAE_WORSEN_DEFAULT_VERSION_TEMPLATE_PARS typename...DummyTypes /* Fake list of types */ |
Provides template par list to unprioritize default SFINAE
Use as last argument of a function overloaded by a other implementations using SFINAE to detect the proper version to be used. This has to be used in conjunction with the other macros SFINAE_WORSEN_DEFAULT_VERSION_ARGS and SFINAE_WORSEN_DEFAULT_VERSION_ARGS_CHECK as in this example
Definition at line 58 of file SFINAE.hpp.