template<class ... Params>
ParameterPack class
Template metaprogramming utilities for parameter packs.
Template parameters | |
---|---|
Params | The parameter pack of types. |
The ParameterPack class provides compile-time utilities for manipulating and querying template parameter packs. It offers type-safe access to individual elements by index and predicate-based validation of all types.
This utility is essential for template metaprogramming where compile-time type manipulation and validation are required.
Example usage:
using Pack = ParameterPack<int, double, std::string>; // Get type at index 1 (double) using SecondType = Pack::At<1>; // Check if all types are arithmetic constexpr bool allArithmetic = Pack::All<std::is_arithmetic>::Value; // Get pack size constexpr size_t packSize = Pack::Size; // 3
Public types
-
template<std::size_t Index>using At = typename Internal::
AtImpl<Index, Params...>::Type - Type alias for accessing the type at a specific index.
-
template<template<class> class Predicate>using All = typename Internal::
AllImpl<Predicate, Params...> - Template alias for checking if all types satisfy a predicate.
Public static variables
- static size_t Size constexpr
- The number of types in the parameter pack.
Typedef documentation
template<class ... Params>
template<std::size_t Index>
using Rodin:: Utility:: ParameterPack<Params>:: At = typename Internal:: AtImpl<Index, Params...>::Type
Type alias for accessing the type at a specific index.
Template parameters | |
---|---|
Index | The zero-based index of the type to access. |
This template alias provides compile-time access to the type at the specified index within the parameter pack. Index bounds are not checked at compile time, so out-of-bounds access will result in compilation errors.
template<class ... Params>
template<template<class> class Predicate>
using Rodin:: Utility:: ParameterPack<Params>:: All = typename Internal:: AllImpl<Predicate, Params...>
Template alias for checking if all types satisfy a predicate.
Template parameters | |
---|---|
Predicate | A template predicate that should have a static constexpr bool Value member. |
This template alias applies the given predicate to all types in the parameter pack and provides a Value member indicating whether all types satisfy the predicate condition.