ParameterPack< T > Struct Template Reference

#include <apibase.h>

Detailed Description

template<typename... T>
struct maxon::ParameterPack< T >

Helper class to work with parameter packs. IndexOf supports finding the index of a type in the argument list, At supports indexing into the list, ContainsAll implements a subset test:

ParameterPack<Int, Float, String, String>::IndexOf<Float>::value == 1
ParameterPack<Int, Float, String, String>::At<2>::type == String
Int64 Int
signed 32/64 bit int, size depends on the platform
Definition: apibase.h:196
Float64 Float
Definition: apibase.h:205
maxon::details::ParameterPackContainsAll< ParameterPack, X... > ContainsAll
Definition: apibase.h:2551
Template Parameters
TThe types of the parameter pack.

Classes

struct  At
 
struct  IndexOf
 

Public Types

using FirstType = void
 
using RestPack = ParameterPack<>
 
template<typename... X>
using ContainsAll = maxon::details::ParameterPackContainsAll< ParameterPack, X... >
 
template<template< typename... > class TEMPLATE, typename... X>
using Apply = TEMPLATE< X... >
 
template<template< typename... > class TEMPLATE, typename... X>
using ApplyAppend = TEMPLATE< X... >
 
template<typename... X>
using Append = ParameterPack< X... >
 
template<typename PACK >
using AppendPack = PACK
 

Static Public Member Functions

template<Int OFFSET = 0, typename LAMBDA >
static ResultOk< void > ForEach (const LAMBDA &lambda)
 

Static Public Attributes

static constexpr Int COUNT
 

Member Typedef Documentation

◆ FirstType

using FirstType = void

The first type of this parameter pack.

◆ RestPack

◆ ContainsAll

ContainsAll checks if this parameter pack contains all types X. Besides a list of types X can also be a ParameterPack itself.

ParameterPack<Int, Float, String, String>::ContainsAll<ParameterPack<String, Int>>::value == true
bool Bool
boolean type, possible values are only false/true, 8 bit
Definition: apibase.h:189
Template Parameters
XTypes to check. This can either be a list of types, or a single ParameterPack.

◆ Apply

using Apply = TEMPLATE<X...>

◆ ApplyAppend

using ApplyAppend = TEMPLATE<X...>

◆ Append

using Append = ParameterPack<X...>

A type alias for a ParameterPack of the types T... and X... I.e., ParameterPack<T...>::Append<X...> is an alias for ParameterPack<T..., X...>.

Template Parameters
XTypes to append to this ParameterPack.

◆ AppendPack

using AppendPack = PACK

A type alias for a ParameterPack of the types of this ParameterPack and PACK. I.e., ParameterPack<T...>::AppendPack<ParameterPack<X...>> is an alias for ParameterPack<T..., X...>.

Template Parameters
PACKAnother ParameterPack to append to this ParameterPack.

Member Function Documentation

◆ ForEach()

static ResultOk<void> ForEach ( const LAMBDA &  lambda)
static

Calls lambda for each type of the parameterpack. lambda is called with a single argument of a type which has index and type members and also a constexpr conversion function to Int which returns the index. member type alias of name #type:

Pack::ForEach(
[] (auto i) -> Result<void>
{
using T = typename decltype(i)::type; // This gives the type of the current parameter pack member.
constexpr Int index = decltype(i)::index; // This gives the index of the current parameter pack member.
constexpr Int index2 = i; // Another way to get the index.
...
return OK;
static const ERROR_OK OK
Definition: resultbase.h:40
#define iferr_scope
Definition: resultbase.h:1636
#define iferr_return
Definition: resultbase.h:1771
Parameters
[in]lambdaIndex within the parameter pack.

Member Data Documentation

◆ COUNT

constexpr Int COUNT
staticconstexpr

The number of types of this parameter pack.