file
TypeTraits.hMacros CORRADE_
Namespaces
- namespace Corrade
- Root namespace.
- namespace Corrade::Utility
- Utilities.
Typedefs
-
template<class T>using IsIterable = std::
integral_constant<bool, implementation-specific> - Traits class for checking whether given type is iterable.
-
template<class T>using IsStringLike = std::
integral_constant<bool, implementation-specific> new in 2019.10 - Traits class for checking whether given type is string-like.
Defines
- #define CORRADE_SOURCE_LOCATION_BUILTINS_SUPPORTED new in Git master
- Whether source location builtins are supported.
- #define CORRADE_STD_IS_TRIVIALLY_TRAITS_SUPPORTED deprecated in Git master
- Whether the std::
is_trivially_copyable family of type traits is supported by the standard library. - #define CORRADE_HAS_TYPE(className, ...)
- Macro for creating traits class that checks for type expression validity.
Define documentation
#define CORRADE_SOURCE_LOCATION_BUILTINS_SUPPORTED new in Git master
Whether source location builtins are supported.
Defined if compiler-specific builtins used to implement the C++20 std::
- Utility::
Debug to optionally annotate the output with source location information. See Source location for details. - TestSuite::
Tester to provide better file/line information for instanced test cases. See the TestSuite:: TestCaseDescriptionSourceLocation class for details.
#define CORRADE_STD_IS_TRIVIALLY_TRAITS_SUPPORTED
Whether the std::
#define CORRADE_HAS_TYPE(className, ...)
Macro for creating traits class that checks for type expression validity.
Parameters | |
---|---|
className | Resulting class name |
... | Type expression to check. Variadic parameter to allow unrestricted usage of template expressions containing commas. |
Defines a traits class checking whether an expression is valid. You can use T
to reference the type which is being checked.
Usage examples: checking for presence of a key_type
member typedef
:
CORRADE_HAS_TYPE(HasKeyType, typename T::key_type); static_assert(HasKeyType<std::map<int, int>>::value, ""); static_assert(!HasKeyType<std::vector<int>>::value, "");
Checking for presence of size()
member function:
CORRADE_HAS_TYPE(HasSize, decltype(std::declval<T>().size())); static_assert(HasSize<std::vector<int>>::value, ""); static_assert(!HasSize<std::tuple<int, int>>::value, "");