- namespace Corrade
- Root namespace.
- namespace Corrade::Utility
template<class T>using IsIterable = std::
- 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.
- #define CORRADE_LONG_DOUBLE_SAME_AS_DOUBLE new in 2020.06
long doublehas the same precision as
- #define CORRADE_SOURCE_LOCATION_BUILTINS_SUPPORTED new in Git master
- Whether source location builtins are supported.
- #define CORRADE_STD_IS_TRIVIALLY_TRAITS_SUPPORTED new in 2020.06
- 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 CORRADE_LONG_DOUBLE_SAME_AS_DOUBLE new in 2020.06
long double has the same precision as
Defined on platforms where the
long double type has a 64-bit precision instead of 80-bit, thus same as
double. It's the case for MSVC (source), 32-bit Android (no reliable source found, sorry), Emscripten and Mac (but not iOS) with ARM processors. Emscripten is a bit special because it's
long double is sometimes 80-bit, but its precision differs from the 80-bit representation elsewhere, so it's always treated as 64-bit. Note that even though the type size and precision may be the same, these are still two distinct types, similarly to how
signed int behave the same but are treated as different types.
#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::
Debug to optionally annotate the output with source location information. See Source location for details.
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 new in 2020.06
Whether the std::
std::has_trivial_copy_assign are available, with slightly different semantics (see e.g. https:/
__has_trivial_assign() builtins that don't produce any deprecated warnings and are available until GCC 9 / Clang 10 at least — however note that for SFINAE you need to wrap them in std::
error: use of built-in trait ‘__has_trivial_copy(T)’ in function signature; use library traits instead
This macro is defined if the standard variants are available. Unfortunately, when libstdc++ is used through Clang, there's no way to check for its version until libstdc++ 7, which added the
_GLIBCXX_RELEASE macro. That means, when using Clang with libstdc++ 5 or 6, it will still report those traits as being unavailable. Both libc++ and MSVC STL have these traits in all versions supported by Corrade, so there the macro is defined always.
#define CORRADE_HAS_TYPE(className, ...)
Macro for creating traits class that checks for type expression validity.
|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
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, "");