Utility module
Type utilities and generic programming helpers.
ParameterPack and Zip support compile-time type and parameter manipulation. Overloaded combines callable visitors, and OptionalReference represents optional non-owning access. These helpers support generic expressions, type dispatch, and reusable library extensions.
For example, Overloaded builds a visitor from lambdas:
std::variant<int, Real> value = 2; const Real result = std::visit(Utility::Overloaded{ [](int x) { return Real(x); }, [](Real x) { return x; } }, value);
Classes
-
template<class T>struct BottomTemplate
- Metafunction to extract the innermost (bottom) type from nested templates.
See specializations
Specialization Description T<S>Full specialization
template < template< class > class T, class S> struct BottomTemplate< T< S >>;
Specialization for single-parameter template instantiations. -
template<class From, class To>class Cast
- Template for defining type conversion operations.
-
template<class T, T ValueParam, class... Args>struct DependentValue
- Creates a type-dependent compile-time constant value.
-
template<class ...>struct Extract
- Template metafunction for extracting types from tuple structures.
See specializations
Specialization Description Tuple<T, Ts...>Specialization of Extract for Tuple types. -
template<typename T, typename = void>struct HasTypeMember
- Type trait to detect if a type has a nested Type member.
See specializations
Specialization Description T, std::void_t<typename T::Type>Full specialization
template < class T> struct HasTypeMember< T, std::void_t< typename T::Type >>;
Specialization for types that have a nested Type member. -
template<typename T, typename = void>struct HasValueMember
- Type trait to detect if a type has a nested Value member type.
See specializations
Specialization Description T, std::void_t<typename T::Value>Full specialization
template < class T> struct HasValueMember< T, std::void_t< typename T::Value >>;
Specialization for types that have a nested Value member type. -
template<typename T, T... Is>class IntegerSequence
- Represents a compile-time sequence of integers.
-
template<typename ...>struct IsOneOf
- Type trait to check if a type is one of a specified list of types.
See specializations
Specialization Description F, S, T...Full specialization
template < typename F, typename S, typename ... T> struct IsOneOf< F, S, T...>;
Specialization for non-empty type lists. -
template<class Test, template<class...> class Ref>struct IsSpecialization
- Type trait to check if a type is a specialization of a given template.
See specializations
Specialization Description Ref<Args...>, RefFull specialization
template < template< class... > class Ref, class... Args> struct IsSpecialization< Ref< Args... >, Ref>;
Specialization for types that are specializations of the reference template. -
template<class T>struct Make
- Factory template for perfect forwarding construction.
-
template<typename T>class OptionalReference
- A wrapper providing optional reference semantics.
-
template<class... Ts>struct Overloaded
- Helper type for creating overloaded function objects from lambdas.
-
template<class ... Params>class ParameterPack
- Template metaprogramming utilities for parameter packs.
-
template<class ...>struct Product
- Metafunction to compute the Cartesian product of two Tuple type-lists.
See specializations
Specialization Description Tuple<H1, H2, Hs...>, Tuple<Gs...>Full specialization
template < class H1, class H2, class ... Hs, class ... Gs> struct Product< Tuple< H1, H2, Hs... >, Tuple< Gs... >>;
Specialization for Tuple with at least two elements (H1, H2, Hs…). Tuple<H>, Tuple<Gs...>Specialization for Tuple with exactly one element. Tuple<>, Tuple<Gs...>Specialization for empty first Tuple. Tuple<Gs...>, Tuple<>Specialization for empty second Tuple. -
template<size_t N, class T>struct Repeat
- Metafunction to create a Tuple with N repetitions of type T.
-
template<class T>struct UnwrapReference
- Metafunction to unwrap std::reference_wrapper types.
See specializations
Specialization Description std::reference_wrapper<U>Full specialization
template < class U> struct UnwrapReference< std::reference_wrapper< U >>;
Specialization for std::reference_wrapper. -
template<class T>struct UnwrapRefDecay
- Combines decay and reference unwrapping.
-
template<class ...>class Wrap
- Metafunction to wrap all types in a Tuple with an external template.
See specializations
Specialization Description Tuple<Ts...>Full specialization
template < class ... Ts> class Wrap< Tuple< Ts... >>;
Specialization for Tuple types. -
template<class ...>struct Zip
- Metafunction to combine two Tuples element-wise using a binary template.
See specializations
Specialization Description Tuple<Ts...>, Tuple<Gs...>Full specialization
template < class ... Ts, class ... Gs> struct Zip< Tuple< Ts... >, Tuple< Gs... >>;
Specialization for two Tuples.
Typedefs
-
template<class T>using IsCompleteType = decltype(Internal::IsCompleteTypeImpl(std::declval<T*>()))
- Type trait to detect if a type is complete (fully defined).
Functions
-
template<class F, class... Args>void For(F&& f, Args && ... args) constexpr
- Performs the application of a function over all arguments.
-
template<size_t N, class F>void ForIndex(F&& f) constexpr
- Executes a function N times with compile-time index access.
-
template<class... Ts>Overloaded(Ts... callables) -> Overloaded< Ts... >
- Deduction guide for Overloaded.
Variables
-
template<class...>bool False constexpr
- Dependent false value for use in static_assert within template contexts.