ivutils
|
Compile time list with a set of bit flags to enable or disable certain elements. More...
#include <ctlist.h>
Public Types | |
using | ListType = CTList< Args... > |
the exact type of CTList stored inside the FixList. | |
using | Tuple = typename ListType::Tuple |
the std::tuple type corresponding to ListType. | |
template<typename ArgType > | |
using | PushBack = typename ListType::template PushBack< ArgType >::ToFixList |
Type of FixList with one more argument in the end. | |
template<int I> | |
using | Get = typename ListType::template Get< I > |
Type of the FixList item by position. | |
using | PopBack = typename ListType::PopBack::ToFixList |
Type of FixList without the last argument. | |
using | Pop = typename ListType::Pop::ToFixList |
Type of FixList without the first argument. | |
template<class Pattern > | |
using | Map = typename ListType::template Map< Pattern >::ToFixList |
Maps every FixList element Arg to either Pattern::template Type<Arg> or Pattern::template Type<Arg, index> whichever is available. | |
template<template< typename > class FilterPattern> | |
using | Filter = typename ListType::template Filter< FilterPattern >::ToFixList |
Compile time filtration of the FixList contents. | |
template<template< typename, typename > class BinaryOperator> | |
using | Reduce = typename ListType::template Reduce< BinaryOperator >::ToFixList |
Compile time Reduce. | |
Public Member Functions | |
template<int I> | |
const Get< I > & | get () const |
Gets const reference to list item. | |
template<int I> | |
Get< I > & | get () |
Gets reference to list item. | |
template<typename T > | |
const T & | get () const |
Gets const reference to list item by its type. | |
template<typename T > | |
T & | get () |
Gets const reference to list item by its type. | |
template<int I, typename InitInterface , typename ... InitArgs> | |
auto | init (InitInterface &&initializer, InitArgs &&... args) -> decltype(initializer(this->get< I >(), std::forward< InitArgs >(args)...)) |
initialize the item by its index and set its bit up. | |
template<typename T , typename InitInterface , typename ... InitArgs> | |
auto | init (InitInterface &&initializer, InitArgs &&... args) -> decltype(initializer(this->get< T >(), std::forward< InitArgs >(args)...)) |
initialize the item by its type and set its bit up. | |
template<int I, typename InitInterface = InitMehtod, typename ... InitArgs> | |
decltype(auto) | init (InitArgs &&... args) |
initialze item by index and set its bit up. | |
template<typename T , typename InitInterface = InitMehtod, typename ... InitArgs> | |
decltype(auto) | init (InitArgs &&... args) |
initialze the item by its type and set its bit up. | |
template<typename T , typename ... FuncArgs> | |
std::array< T, This::size()> | map2array (const T &fallback, FuncArgs &&... fargs) |
Calls a function for each FixList's item and store results in std::array. | |
template<typename ... FuncArgs> | |
void | foreach (FuncArgs &&... fargs) |
Calls a function for each FixList item except std::ignore or the items with their bit set to false . | |
template<typename ... Fargs> | |
auto | map (Fargs &&... fargs) -> typename decltype(data.map(std::forward< Fargs >(fargs)...))::ToFixList |
Map FixList contents to another FixList. | |
template<template< typename > class Filter> | |
auto | filter () -> typename decltype(this->data.template filter< Filter >())::ToFixList |
Compile time part of the filter function. | |
template<typename ... Fargs> | |
auto | filter (Fargs &&... fargs) |
Runtime part of the filter function. | |
template<template< typename > class Filter, typename ... Fargs> | |
auto | filter (Fargs &&... fargs) -> decltype(this->filter< Filter >()) |
Combines the compile time and runtime filter together. | |
void | clear () |
Sets all items to inactive and reinitialize the with default constructors. | |
const BitSetType & | get_fix () |
template<int I> | |
bool | initialized () |
Check if the item for corresponding index is active. | |
template<typename T > | |
bool | initialized () |
Check if the item for corresponding type is active. | |
Static Public Member Functions | |
static constexpr int | size () |
Length of FixList. | |
template<typename T > | |
static constexpr bool | Contains () |
Checks if a type is in the list. | |
template<typename T > | |
static constexpr int | Index () |
Calculates the index of a type. | |
template<int I> | |
static bool | static_initialized (int fix_val) |
Check if the item for corresponding index is active in provided bitset. | |
template<typename T > | |
static bool | static_initialized (int fix_val) |
Check if the item for corresponding type is active in provided bitset. | |
template<typename ... FArgs> | |
static auto | static_map2array (FArgs &&... fargs) |
calls static_map2array for internal CTList. | |
template<typename ... FArgs> | |
static void | static_foreach (FArgs &&... fargs) |
calls static_foreach for internal CTList. | |
Static Public Attributes | |
static constexpr unsigned long long | full_mask = BitSetType::full |
the bitset value corresponiding to the list with every element enabled. | |
Compile time list with a set of bit flags to enable or disable certain elements.
Args | the list items. |
using FixList< Args >::Filter = typename ListType::template Filter<FilterPattern>::ToFixList |
Compile time filtration of the FixList contents.
Empty FixList doesn't have Map member type. It substitutes all filtered out types by decltype(std::ignore)
which is ignored by most of runtime calls.
FilterPattern<Item> | is a template parametrized with a typename Item . It contains a static constexpr bool value which is true if Item shouldn't be filtered and false otherwise. |
using FixList< Args >::Get = typename ListType::template Get<I> |
Type of the FixList item by position.
I | is the item position index. |
using FixList< Args >::PushBack = typename ListType::template PushBack<ArgType>::ToFixList |
Type of FixList with one more argument in the end.
ArgType | type of the new element. |
|
inlinestaticconstexpr |
Checks if a type is in the list.
T | is the type to check. |
|
inline |
Compile time part of the filter function.
Function is disabled for empty FixList.
Filter<Item> | is the filter pattern. It is the same type of pattern as in Filter. |
|
inline |
Runtime part of the filter function.
Function is disabled for empty FixList.
Fargs | list of template arguments. The first one is the function type. All the following are types of additional function arguments, expected to be deduced automatically. The filter function should return bool and take one of the following
|
fargs | the filter function and its additional arguments which are passed to the filter function as is |
|
inline |
Combines the compile time and runtime filter together.
Function is disabled for empty FixList.
Filter<Item> | is the template argument for compile time filter |
fargs | are the arguments foe runtime part of the filter |
|
inline |
Calls a function for each FixList item except std::ignore or the items with their bit set to false
.
The foreach function doesn't return anything.
FArgs | types of arguments, should be deduced automatically. |
fargs | arguments list passed to a function. The first one should be a function which returns void and takes one of the following
|
Gets reference to list item.
I | is the item index. Function should not compile if I is beyond list range. In that case it would report tuple index out of range. |
Gets const reference to list item by its type.
Function should not compile if the type is not in list or if there is multiple items of the type in the list. In the first case it would report tuple index out of range,
T | is the item Type. |
Gets const reference to list item.
I | is the item index. Function should not compile if I is beyond list range. In that case it would report tuple index out of range. |
Gets const reference to list item by its type.
Function should not compile if the type is not in list or if there is multiple items of the type in the list. In the first case it would report tuple index out of range,
T | is the item Type. |
|
inline |
|
inlinestaticconstexpr |
Calculates the index of a type.
It is assumed that all types in the list are unique.
T | is the type we want index for. |
|
inline |
initialze item by index and set its bit up.
I | the index of the item |
InitInterface | the interface class with init method which initializes the item. InitInterface::init method takes the reference to the item as the first argument which is followed by args list. |
InitArgs | types of arguments to initialize the item. |
args | list of the additional arguments to initialize the item. |
item.init
|
inline |
initialze the item by its type and set its bit up.
T | the type of the item |
InitInterface | the interface class with init method which initializes the item. InitInterface::init method takes the reference to the item as the first argument which is followed by args list. |
InitArgs | types of arguments to initialize the item. |
args | list of the additional arguments to initialize the item. |
item.init
|
inline |
initialize the item by its index and set its bit up.
I | the index of the item |
InitInterface | the interface callable type which initializes the item. |
InitArgs | types list for initialization arguments. |
initializer | callable to initialize the item. It takes the reference to the item as the first argument, and all the args. |
args | list of additional arguments for initalization function |
|
inline |
initialize the item by its type and set its bit up.
T | the type of item. Function will fail to compile if there are multiple items of the type T in the list. |
InitInterface | the interface callable type which initializes the item. |
InitArgs | types list for initialization arguments. |
initializer | callable to initialize the item. It takes the reference to the item as the first argument, and all the args. |
args | list of additional arguments for initalization function |
Check if the item for corresponding index is active.
I | the item's index |
Check if the item for corresponding type is active.
If there are multiple items of the type in the list function fails to compile.
T | the item's type |
|
inline |
Map FixList contents to another FixList.
The map function is applied even to the items with their bits set to false
. Function is disabled for empty FixList.
Fargs | types of fargs, should be deduced automatically. |
fargs | is the list of arguments. First one is a function (callable object) which has a call operator which can take one of the following
|
|
inline |
Calls a function for each FixList's item and store results in std::array.
Function is disabled for empty FixLIst.
FArgs | types of arguments, should be deduced automatically. |
fallback | value, which would be returned in case std::ignore appeared in the list or if the bit of the item is set to false . |
fargs | function arguments list. The second argument is a function (callable object) which has a call operator which can take one of the following
|
|
inlinestaticconstexpr |
Length of FixList.
|
inlinestatic |
calls static_foreach for internal CTList.
|
inlinestatic |
Check if the item for corresponding index is active in provided bitset.
I | the item's index |
fix_val | bitset to check |
|
inlinestatic |
Check if the item for corresponding type is active in provided bitset.
If there are multiple items of the type in the list function fails to compile.
T | the item's type |
fix_val | bitset to check |
|
inlinestatic |
calls static_map2array for internal CTList.