C++ Utilities 5.26.1
Useful C++ classes and routines such as argument parser, IO and conversion utilities
|
Contains traits for conveniently exploiting SFINAE. More...
Classes | |
struct | All |
Evaluates to Bool<true> if all specified conditions are true; otherwise evaluates to Bool<false>. More... | |
struct | All< Head, Tail... > |
Evaluates to Bool<true> if all specified conditions are true; otherwise evaluates to Bool<false>. More... | |
struct | Any |
Evaluates to Bool<true> if at least one of the specified conditions is true; otherwise evaluates to Bool<false>. More... | |
struct | Any< Head, Tail... > |
Evaluates to Bool<true> if at least one of the specified conditions is true; otherwise evaluates to Bool<false>. More... | |
struct | Bool |
Wraps a static boolean constant. More... | |
struct | IsAnyOf |
Evaluates to Bool<true> if the specified type is any of the specified types; otherwise evaluates to Bool<false>. More... | |
struct | IsAnyOf< Type, OtherType, RemainingTypes... > |
Evaluates to Bool<true> if the specified type is any of the specified types; otherwise evaluates to Bool<false>. More... | |
struct | IsComplete |
Evaluates to Bool<true> if the specified type is complete; if the type is only forward-declared it evaluates to Bool<false>. More... | |
struct | IsComplete< T, decltype(void(sizeof(T)))> |
Evaluates to Bool<true> if the specified type is complete; if the type is only forward-declared it evaluates to Bool<false>. More... | |
struct | IsCString |
Evaluates to Bool<true> if the specified type is a C-string (char * or const char *); otherwise evaluates to Bool<false>. More... | |
struct | IsNoneOf |
Evaluates to Bool<true> if the specified type is none of the specified types; otherwise evaluates to Bool<false>. More... | |
struct | IsNoneOf< Type, OtherType, RemainingTypes... > |
Evaluates to Bool<true> if the specified type is none of the specified types; otherwise evaluates to Bool<false>. More... | |
struct | IsSpecializationOf |
Evaluates to Bool<true> if the specified type is based on the specified template; otherwise evaluates to Bool<false>. More... | |
struct | IsSpecializingAnyOf |
Evaluates to Bool<true> if the specified type is based on one of the specified templates; otherwise evaluates to Bool<false>. More... | |
struct | IsSpecializingAnyOf< Type, TemplateType, RemainingTemplateTypes... > |
Evaluates to Bool<true> if the specified type is based on one of the specified templates; otherwise evaluates to Bool<false>. More... | |
struct | IsString |
Evaluates to Bool<true> if the specified type is a standard string, standard string view or C-string (char * or const char *); otherwise evaluates to Bool<false>. More... | |
struct | None |
Evaluates to Bool<true> if none of the specified conditions are true; otherwise evaluates to Bool<false>. More... | |
struct | None< Head, Tail... > |
Evaluates to Bool<true> if none of the specified conditions are true; otherwise evaluates to Bool<false>. More... | |
Typedefs | |
template<typename If , typename Then , typename Else > | |
using | Conditional = typename std::conditional<If::value, Then, Else>::type |
Shortcut for std::conditional to omit ::value and ::type. | |
template<typename T > | |
using | Not = Bool<!T::value> |
Negates the specified value. | |
template<typename... Condition> | |
using | EnableIf = typename std::enable_if<All<Condition...>::value, Detail::Enabler>::type |
Shortcut for std::enable_if to omit ::value and ::type. | |
template<typename... Condition> | |
using | DisableIf = typename std::enable_if<!All<Condition...>::value, Detail::Enabler>::type |
Shortcut for std::enable_if to negate the condition and omit ::value and ::type. | |
template<typename... Condition> | |
using | EnableIfAny = typename std::enable_if<Any<Condition...>::value, Detail::Enabler>::type |
Shortcut for std::enable_if to apply Traits::Any and omit ::value and ::type. | |
template<typename... Condition> | |
using | DisableIfAny = typename std::enable_if<!Any<Condition...>::value, Detail::Enabler>::type |
Shortcut for std::enable_if to apply Traits::Any, negate the condition and omit ::value and ::type. | |
Functions | |
CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK (IsDereferencable, *(std::declval< T & >())) | |
Evaluates to Bool<true> if the specified type can be dereferenced using the *-operator; otherwise evaluates to Bool<false>. | |
CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK (HasSize, std::is_integral< decltype(std::declval< T & >().size())>::value) | |
Evaluates to Bool<true> if the specified type can has a size() method; otherwise evaluates to Bool<false>. | |
CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK (IsReservable, std::declval< T & >().reserve(0u)) | |
Evaluates to Bool<true> if the specified type can has a reserve() method; otherwise evaluates to Bool<false>. | |
CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK (IsResizable, std::declval< T & >().resize(0u)) | |
Evaluates to Bool<true> if the specified type can has a resize() method; otherwise evaluates to Bool<false>. | |
CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK (HasOperatorBool, std::declval< T & >() ? true :false) | |
Evaluates to Bool<true> if the specified type has operator bool(); otherwise evaluates to Bool<false>. | |
CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK (IsIteratable, std::begin(std::declval< T & >()) !=std::end(std::declval< T & >()) CPP_UTILITIES_PP_COMMA void() CPP_UTILITIES_PP_COMMA++std::declval< decltype(begin(std::declval< T & >())) & >() CPP_UTILITIES_PP_COMMA void(*begin(std::declval< T & >()))) | |
Evaluates to Bool<true> if the specified type is iteratable (can be used in for-each loop); otherwise evaluates to Bool<false>. | |
template<typename T , EnableIf< IsDereferencable< T > > * = nullptr> | |
constexpr auto & | dereferenceMaybe (T &&value) |
Dereferences the specified value if possible; otherwise just returns value itself. | |
Contains traits for conveniently exploiting SFINAE.
using CppUtilities::Traits::Conditional = typename std::conditional<If::value, Then, Else>::type |
using CppUtilities::Traits::DisableIf = typename std::enable_if<!All<Condition...>::value, Detail::Enabler>::type |
using CppUtilities::Traits::DisableIfAny = typename std::enable_if<!Any<Condition...>::value, Detail::Enabler>::type |
Shortcut for std::enable_if to apply Traits::Any, negate the condition and omit ::value and ::type.
using CppUtilities::Traits::EnableIf = typename std::enable_if<All<Condition...>::value, Detail::Enabler>::type |
using CppUtilities::Traits::EnableIfAny = typename std::enable_if<Any<Condition...>::value, Detail::Enabler>::type |
Shortcut for std::enable_if to apply Traits::Any and omit ::value and ::type.
using CppUtilities::Traits::Not = Bool<!T::value> |
CppUtilities::Traits::CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK | ( | HasOperatorBool | , |
std::declval< T & >() ? true :false | ) |
Evaluates to Bool<true> if the specified type has operator bool(); otherwise evaluates to Bool<false>.
CppUtilities::Traits::CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK | ( | HasSize | , |
std::is_integral< decltype(std::declval< T & >().size())>::value | ) |
Evaluates to Bool<true> if the specified type can has a size() method; otherwise evaluates to Bool<false>.
CppUtilities::Traits::CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK | ( | IsDereferencable | , |
* | std::declval< T & >() ) |
Evaluates to Bool<true> if the specified type can be dereferenced using the *-operator; otherwise evaluates to Bool<false>.
CppUtilities::Traits::CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK | ( | IsIteratable | , |
std::begin(std::declval< T & >()) ! | = std::end(std::declval< T & >()) CPP_UTILITIES_PP_COMMA void() CPP_UTILITIES_PP_COMMA++std::declval< decltype(begin(std::declval< T & >())) & >() CPP_UTILITIES_PP_COMMA void(*begin(std::declval< T & >())) ) |
Evaluates to Bool<true> if the specified type is iteratable (can be used in for-each loop); otherwise evaluates to Bool<false>.
CppUtilities::Traits::CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK | ( | IsReservable | , |
std::declval< T & > | ).reserve(0u ) |
Evaluates to Bool<true> if the specified type can has a reserve() method; otherwise evaluates to Bool<false>.
CppUtilities::Traits::CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK | ( | IsResizable | , |
std::declval< T & > | ).resize(0u ) |
Evaluates to Bool<true> if the specified type can has a resize() method; otherwise evaluates to Bool<false>.