xentara-utils v2.0.4
The Xentara Utility Library
|
Tools and utilities. More...
Namespaces | |
namespace | byteSwap |
namespace | deprecated |
Classes | |
class | DataAllocatorPair |
A compound class pairing a possibly empty allocator with data. More... | |
class | Defer |
A class that executes a callable at destruct time. More... | |
class | DeferThrowing |
A class that executes a callable at destruct time, catching exceptions if necessary. More... | |
class | DisableCopy |
A class that can be neither copied nor moved. More... | |
class | Hash |
A hash object with extended functionality. More... | |
struct | IsArithmetic |
Determines if a type is an arithmetic type, but not a bool or a special character type. More... | |
struct | IsBool |
Determines if a type is a Boolean type. More... | |
struct | IsCharType |
Determines if a type is a special character type. More... | |
struct | IsIeeeFloatingPoint |
Determines if a type is an IEEE floating point. More... | |
struct | IsIntegral |
Determines if a type is an integral type, but not a bool or a special character type. More... | |
struct | IsNothrowStringViewable |
Determines if a type can be converted to a string view without throwing exceptions. More... | |
struct | IsNothrowStringViewConstructible |
Determines if a type can be constructed from a string view without throwing exceptions. More... | |
struct | IsParameterPackType |
Determines if a type is a specialization of ParameterPack. More... | |
struct | IsSame |
Determines if two types are the same, without taking into account qualifiers or references. More... | |
struct | IsStringType |
Determines if a type is a specialization of std::basic_string. More... | |
struct | IsStringViewable |
Determines if a type can be converted to a string view. More... | |
struct | IsStringViewConstructible |
Determines if a type can be constructed from a string view. More... | |
struct | IsStringViewType |
Determines if a type is a specialization of std::basic_string_view. More... | |
struct | NotCopyMove |
Checks whether a parameter pack doesn't consist of a single element with a specific type. More... | |
struct | ParameterPack |
A marker for a pack of parameters. More... | |
struct | ParameterPack<> |
Specialization for an empty paramter pack. More... | |
class | PolymorphicVariant |
An aligned union for polymorphic types derived from a base class. More... | |
class | Unique |
A class that can be moved but not copied. More... | |
class | UnownedPointer |
A non-owning pointer that is interface compatible with std::unique_ptr. More... | |
class | UnownedPointer< Element[], Deleter > |
Template specialization of UnownedPointer for array types. More... | |
Concepts | |
concept | Integral |
Determines if a type is an integral type, but not a bool or a special character type. | |
concept | SignedIntegral |
Determines if a type is a signed integral type, but not a bool or a special character type. | |
concept | UnsignedIntegral |
Determines if a type is an integral type, but not a bool or a special character type. | |
concept | Arithmetic |
Determines if a type is an arithmetic type, but not a bool or a special character type. | |
concept | IeeeFloatingPoint |
A concept describing an IEEE floating point. | |
concept | Bool |
Determines if a type is a Boolean type. | |
concept | CharType |
Determines if a type is a special character type. | |
concept | StringType |
Determines if a type is a specialization of std::basic_string. | |
concept | StringViewType |
Determines if a type is a specialization of std::basic_string_view. | |
concept | StringViewable |
Determines if a type can be converted to a string view. | |
concept | StringViewConstructible |
Determines if a type can be constructed from a string view. | |
concept | SameAs |
Determines if two types are the same, without taking into account qualifiers or references. | |
concept | OneOf |
Determines if a type is one of a list of allowed types. | |
concept | Singleton |
A concept used for singleton classes. | |
concept | NullablePointer |
A concept for pointers that can be nulled. | |
concept | Allocator |
A concept for pointers that can be nulled. | |
concept | EqualityComparableWithExcept |
Helper concept for implementing equality comparison operators. | |
concept | ThreeWayComparableWithExcept |
Helper concept for implementing three-way comparison operators. | |
concept | StdHashable |
This concept checks whether a class has a proper specialization for std::hash. | |
concept | ParameterPackType |
Determines if a type is a specialization of ParameterPack. | |
Typedefs | |
template<std::size_t kSize> | |
using | IntegerWithSize = __sized_integer_type__< kSize > |
A template that can be used to find an integer type with a certain size. | |
template<std::size_t kSize> | |
using | UnsignedIntegerWithSize = __sized_unsigned_integer_type__< kSize > |
A template that can be used to find an unsigned integer type with a certain size. | |
template<std::size_t kSize> | |
using | ExtendedIntegerWithSize = __sized_extended_integer_type__< kSize > |
A template that can be used to find a possibly extended integer type with a certain size. | |
template<std::size_t kSize> | |
using | ExtendedUnsignedIntegerWithSize = __sized_extended_unsigned_integer_type__< kSize > |
A template that can be used to find a possibly extended unsigned integer type with a certain size. | |
template<typename Type > | |
using | StringViewableCharType = __string_viewable_char_type__< Type > |
A template that can be used to find the character type of the string view that a type can be converted to. | |
template<typename Type > | |
using | StringViewableViewType = std::basic_string_view< StringViewableCharType< Type > > |
A template that can be used to find the string view type that a type can be converted to. | |
template<typename Type > | |
using | StringViewConstructibleCharType = __string_view_constructible_char_type__< Type > |
A template that can be used to find the character type of the string view that a type can be constructed from. | |
template<typename Type > | |
using | StringViewConstructibleViewType = std::basic_string_view< StringViewConstructibleCharType< Type > > |
A template that can be used to find the string view type that a type can be constructed from. | |
template<typename Type > | |
using | InputArgumentType = typename detail::InputArgumentType< std::remove_cvref_t< Type > >::Type |
Gets a suitable type for passing an object to a function as an input argument. | |
Functions | |
template<typename To , typename From > requires (sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From> && std::is_trivially_copyable_v<To>) | |
constexpr auto | bit_cast (const From &from) noexcept -> To |
Replacement for std::bit_cast on systems where it is missing. | |
template<typename Type , typename... PackTypes> | |
constexpr auto | countOfType () noexcept -> std::size_t |
Returns the number of times a type appears in a parameter pack. | |
template<typename Type , typename... PackTypes> | |
constexpr auto | get (PackTypes &&... pack) noexcept -> decltype(auto) |
Gets the first member of a certain type from a parameter pack. | |
template<typename Type , auto kFallback, typename... PackTypes> | |
constexpr auto | getOr (PackTypes &&... pack) noexcept -> decltype(auto) |
Gets the first value of a certain type from a parameter pack. | |
template<typename Type , typename... PackTypes> | |
constexpr auto | indexOfType () noexcept -> std::size_t |
Returns the index of a type within a parameter pack. | |
auto | unreachable () -> void |
This is a dummy function that lets the compiler that this part of the code cannot be reached. | |
template<typename Visitor , typename... Values> | |
constexpr auto | visit (Visitor &&visitor, Values &&... values) -> void |
Executes a callable visitor for a series of values. | |
template<typename Visitor , typename Tuple > requires requires { std::tuple_size<std::remove_reference_t<Tuple>>::value; } | |
constexpr auto | visitTuple (Visitor &&visitor, Tuple &&tuple) -> void |
Executes a callable visitor for all the members of a tuple. | |
Variables | |
constexpr bool | kHasConstexprBitCast |
Constant describing whether bit_cast is constexpr. | |
template<typename > | |
constexpr bool | kAlwaysFalse |
A value of false. | |
template<typename... Parameters> | |
constexpr ParameterPack< Parameters... > | kParameterPack |
A marker for a pack of parameters. | |
template<typename Type , typename... ParameterPack> | |
constexpr bool | kNotCopyMove |
Checks whether a parameter pack contains a single element with a specific type. | |
Tools and utilities.
This namespace contains various tools and utilities, mainly for template meta programming.
using xentara::utils::tools::ExtendedIntegerWithSize = typedef __sized_extended_integer_type__<kSize> |
A template that can be used to find a possibly extended integer type with a certain size.
This type alias is equivalent to IntegerWithSize, except that it may return extended integer types like *__int128*.
If there is no integer or extended integer type with the specified size, this type is not defined.
using xentara::utils::tools::ExtendedUnsignedIntegerWithSize = typedef __sized_extended_unsigned_integer_type__<kSize> |
A template that can be used to find a possibly extended unsigned integer type with a certain size.
This type alias is equivalent to UnsignedIntegerWithSize, except that it may return extended integer types like unsigned __int128.
If there is no unsigned integer or extended unsigned integer type with the specified size, this type is not defined.
using xentara::utils::tools::InputArgumentType = typedef typename detail::InputArgumentType<std::remove_cvref_t<Type> >::Type |
Gets a suitable type for passing an object to a function as an input argument.
This type alias tries to determine whether an argument should be passed by reference or by value. It either maps to Type, or to const Type &. Most types will map to const type &, except for the following:
using xentara::utils::tools::IntegerWithSize = typedef __sized_integer_type__<kSize> |
A template that can be used to find an integer type with a certain size.
If there is no integer type with the specified size, this type is not defined.
using xentara::utils::tools::StringViewableCharType = typedef __string_viewable_char_type__<Type> |
A template that can be used to find the character type of the string view that a type can be converted to.
If the given type cannot be converted to a string view, or if it can be converted to multiple types of string view, this type is not defined.
using xentara::utils::tools::StringViewableViewType = typedef std::basic_string_view<StringViewableCharType<Type> > |
A template that can be used to find the string view type that a type can be converted to.
If the given type cannot be converted to a string view, or if it can be converted to multiple types of string view, this type is not defined.
using xentara::utils::tools::StringViewConstructibleCharType = typedef __string_view_constructible_char_type__<Type> |
A template that can be used to find the character type of the string view that a type can be constructed from.
If the given type cannot be constructed from a string view, or if it can be constructed from multiple types of string view, this type is not defined.
using xentara::utils::tools::StringViewConstructibleViewType = typedef std::basic_string_view<StringViewConstructibleCharType<Type> > |
A template that can be used to find the string view type that a type can be constructed from.
If the given type cannot be constructed from a string view, or if it can be constructed from multiple types of string view, this type is not defined.
using xentara::utils::tools::UnsignedIntegerWithSize = typedef __sized_unsigned_integer_type__<kSize> |
A template that can be used to find an unsigned integer type with a certain size.
If there is no unsigned integer type with the specified size, this type is not defined.
|
constexprnoexcept |
Replacement for std::bit_cast on systems where it is missing.
This is an implementation of std::bit_cast for platforms on which is is missing. On platforms that supply an std::bit_cast, this is simply a using-directive for std::bit_cast.
|
constexprnoexcept |
Returns the number of times a type appears in a parameter pack.
This function counts how many times a parameter appears in a parameter pack. The type is considered matching if std::remove_cvref_t<PackType> is the same as the given type.
Type | The type to search for |
...PackTypes | The types in the parameter pack |
|
constexprnoexcept |
Gets the first member of a certain type from a parameter pack.
This function extracts the first parameter whose type matches that in a parameter pack. The type is considered matching if std::remove_cvref_t<PackType> is the same as the given type.
Type | The desired type. |
...PackTypes | The types in the parameter pack. Must contain at least one instance of Type. |
...pack | The parameter pack |
|
constexprnoexcept |
Gets the first value of a certain type from a parameter pack.
This function extracts the first value whose type matches that in a parameter pack. The type is considered matching if std::remove_cvref_t<PackType> is the same as the given type.
This function returns a fallback value if none of the pack does not contain any suitable types. The fallback value is contained in the template parameter kFallback. kFallback must be a value that can be implicitly converted to Type.
Not all C++ types can be used as template parameters. To provide a fallback value of a type that is not suitable for use as a template parameter, you can use the following workaround:
Type | The desired type. |
kFallback | The value to return if the pack does not contain any suitable types. |
...PackTypes | The types in the parameter pack |
...pack | The parameter pack |
|
constexprnoexcept |
Returns the index of a type within a parameter pack.
This function gets the index of a type within a parameter pack. The type is considered matching if std::remove_cvref_t<PackType> is the same as the given type.
Type | The type to search for |
...PackTypes | The types in the parameter pack |
auto xentara::utils::tools::unreachable | ( | ) | -> void |
This is a dummy function that lets the compiler that this part of the code cannot be reached.
|
constexpr |
Executes a callable visitor for a series of values.
visitor | The visitor |
...values | The values |
|
constexpr |
Executes a callable visitor for all the members of a tuple.
visitor | The visitor |
tuple | The tuple |
|
constexpr |
A value of false.
This constant can be used to trigger static asserts unconditionally in template instantiations where the assert needs to be always false, but dependend on a parameter.
|
constexpr |
Constant describing whether bit_cast is constexpr.
|
constexpr |
Checks whether a parameter pack contains a single element with a specific type.
This value checks whether a parameter pack doesn't consist of exactly one parameter that is a possibly CV-qualified version of a certain type, or a possibly CV-qualified reference to that type. This can be used to prevent templated constructors from qualifying as copy and/or move constructors.
Type | The type to check for |
ParameterPack | The parameter pack |
|
constexpr |
A marker for a pack of parameters.
This is an empty object that can be used in meta programming to represent a parameter pack. It is used in a similar way to std::in_place_type: it can be passed to a function to select an overload that uses a certain pack of parameter templates