ivutils
|
The compile time list. More...
#include <ctlist.h>
Public Types | |
using | ToFixList = FixList< Args... > |
Converting CTList to the FixList. Essentially adds a bitset to declaration. | |
using | Tuple = std::tuple< Args ... > |
Internal std::tuple exact type. | |
template<typename ArgType > | |
using | PushBack = CTList< Args..., ArgType > |
Type of CTList with one more argument in the end. | |
template<int I> | |
using | Get = typename std::tuple_element< I, Tuple >::type |
Type of the CTList item by position. | |
using | PopBack = typename Remove< This >::Last |
Type of CTList without the last argument. | |
using | Pop = typename Remove< This >::First |
Type of CTList without the first argument. | |
template<class Pattern > | |
using | Map = ctlist::internal::MapCTList< Pattern, This > |
Maps every CTList 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 This::Map< IgnoreFiltered< FilterPattern > > |
Compile time filtration of the CTList contents. | |
template<template< typename, typename > class BinaryOperator> | |
using | Reduce = typename ctlist::internal::CTListReduce< BinaryOperator, This >::Type |
Compile time Reduce. | |
Public Member Functions | |
constexpr | CTList () |
Default constructor assumes that all types in list also have default constructor. | |
constexpr | CTList (const This &other)=default |
The copy constructor is created by default. | |
constexpr | CTList (Args &&... args) |
Constructor with default types, which is needed to allow brace enclosed intialization for each entry. | |
template<typename ... CArgs, typename std::enable_if< std::is_constructible< Tuple, CArgs... >::value, int >::type disabler = 0> | |
constexpr | CTList (CArgs &&... cargs) |
Constructor proxy for std::tuple. | |
constexpr | operator Tuple () const |
The CTList may be explicitly converted to underlying tuple type. | |
constexpr | operator Tuple & () |
The CTList may be explicitly converted to reference to it's data. | |
constexpr | operator const Tuple & () const |
The CTList may be explicitly converted to const reference to it's data. | |
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<typename ... FArgs> | |
auto | map (FArgs &&... fargs) |
Map List contents to another CTList Functions disabled for empty CTList. | |
template<typename ... FArgs> | |
auto | map (FArgs &&... fargs) const |
Map List contents to another CTList. | |
template<typename ... FArgs> | |
auto | map2array (FArgs &&... fargs) |
Calls a function for each CTList's item and store results in std::array. | |
template<typename ... FArgs> | |
auto | map2array (FArgs &&... fargs) const |
Calls a function for each CTList's item and store results in std::array. | |
template<typename ... FArgs> | |
auto | foreach (FArgs &&... fargs) const |
Calls a function for each CTList item except the case it is std::ignore. | |
template<typename ... FArgs> | |
const auto | foreach (FArgs &&... fargs) |
Calls a function for each CTList item except the case it is std::ignore. | |
template<template< typename > class Filter> | |
auto | filter () |
Compile time part of the filter function. | |
template<template< typename > class Filter> | |
auto | filter () const |
Compile time part of the filter function. | |
template<typename FilterFunc , typename ... Fargs> | |
FixList< typename std::add_lvalue_reference< Args >::type... > | filter (FilterFunc &&filterf, Fargs &&... fargs) |
Runtime part of the filter function. | |
template<typename FilterFunc , typename ... Fargs> | |
FixList< typename std::add_lvalue_reference_t< std::add_const_t< Args > >... > | filter (FilterFunc &&filterf, Fargs &&... fargs) const |
Runtime part of the filter function. | |
template<template< typename > class Filter, typename ... Fargs> | |
auto | filter (Fargs &&... fargs) |
Combines the compile time and runtime filter together. | |
template<template< typename > class Filter, typename ... Fargs> | |
auto | filter (Fargs &&... fargs) const |
Combines the compile time and runtime filter together. | |
auto | pop_back () |
METHOD DOESN'T COPY DATA List contents without the last element. | |
auto | pop () |
METHOD DOESN'T COPY DATA List contents without the first element. | |
Static Public Member Functions | |
static constexpr int | size () |
Length of CTList. | |
template<typename T > | |
static constexpr int | Count () |
Number of items of a certain type in CTList. | |
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<typename ... FArgs> | |
static auto | static_map2array (FArgs &&... fargs) |
Calls a function for each CTList's item type which is not marked inactive in the provided bitset and store results in std::array. | |
template<typename ... FArgs> | |
static auto | static_foreach (FArgs &&... fargs) |
Calls a function for each CTList item which is not marked inactive for the provided bitset. | |
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. | |
Static Public Attributes | |
static constexpr unsigned long long | full_mask = (1<<This::size())-1 |
the bitset value corresponiding to the list with every element enabled. | |
The compile time list.
It uses a tuple<Args...>
as an internal runtime container.
...Args | are the types contained in CTList . |
using CTList< Args >::Filter = typename This::Map<IgnoreFiltered<FilterPattern> > |
Compile time filtration of the CTList contents.
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 CTList< Args >::Get = typename std::tuple_element<I, Tuple>::type |
Type of the CTList item by position.
I | is the item position index. |
using CTList< Args >::PushBack = CTList<Args..., ArgType> |
Type of CTList with one more argument in the end.
ArgType | type of the new element. |
Default constructor assumes that all types in list also have default constructor.
In other cases different constructor should be used.
The copy constructor is created by default.
This constructor would be created anyways, but it's important to know there is a copy constructor here.
Constructor with default types, which is needed to allow brace enclosed intialization for each entry.
For example CTList<Arg1, Arg2> test_list({intializer_for_Arg1}, {intializer_for_Arg2})
.
|
inlineconstexpr |
Constructor proxy for std::tuple.
Disabled if the arguments can't construct a tuple. It works for all the cases which are not covered by previous three constructors. For example intialization with tuple (lvalue or rvalue) is handled by it.
|
inlinestaticconstexpr |
Checks if a type is in the list.
T | is the type to check. |
|
inlinestaticconstexpr |
Number of items of a certain type in CTList.
T | is the type to query. |
|
inline |
|
inline |
Compile time part of the filter function.
This is the constant version of the function. Function is disabled for empty CTList.
Filter<Item> | is the filter pattern. It is the same type of pattern as in Filter. |
|
inline |
Combines the compile time and runtime filter together.
Function is disabled for empty CTList.
Filter<Item> | is the template argument for compile time filter |
fargs | are the arguments foe runtime part of the filter |
|
inline |
Combines the compile time and runtime filter together.
Const CTList version. Function is disabled for empty CTList.
Filter<Item> | is the template argument for compile time filter |
fargs | are the arguments foe runtime part of the filter |
|
inline |
Runtime part of the filter function.
Function is disabled for empty CTList.
FilterFunc | type if the function, expected to be deduced automatically. |
Fargs | types of additional function arguments, expected to be deduced automatically. |
filterf | is the filter function object which should return bool and takes one of the following
|
fargs | additional arguments which are passed to the filter function as is |
|
inline |
Runtime part of the filter function.
Version of the function for const CTList. Function is disabled for empty CTList.
FilterFunc | type if the function, expected to be deduced automatically. |
Fargs | types of additional function arguments, expected to be deduced automatically. |
filterf | is the filter function object which should return bool and takes one of the following
|
fargs | additional arguments which are passed to the filter function as is |
|
inline |
Calls a function for each CTList item except the case it is std::ignore.
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
|
|
inline |
Calls a function for each CTList item except the case it is std::ignore.
This is version of a function for const CTList. 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. |
|
inlinestaticconstexpr |
Calculates the index of a type.
Fails to compile if there is more than one item of the type
T | is the type we want index for. |
|
inline |
Map List contents to another CTList Functions disabled for empty CTList.
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 opetor which can take one of the following
|
|
inline |
Map List contents to another CTList.
This is the version of the function for const CTList. Functions disabled for empty CTList.
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 opetor which can take one of the following
|
|
inline |
Calls a function for each CTList's item and store results in std::array.
Function is disabled for empty CTList.
FArgs | types of arguments, should be deduced automatically. |
fargs | function arguments list. The first argument must be a fallback value, which would be returned in case std::ignore appeared in the list. The second argument is a function (callable object) which has a call operator which can take one of the following
|
|
inline |
Calls a function for each CTList's item and store results in std::array.
This is constant CTList version of the function. Function is disabled for empty CTList.
FArgs | types of arguments, should be deduced automatically. |
fargs | function arguments list. The first argument must be a fallback value, which would be returned in case std::ignore appeared in the list. The second argument is a function (callable object) which has a call operator which can take one of the following
|
|
inlineexplicitconstexpr |
The CTList may be explicitly converted to const reference to it's data.
This conversion doesn't copy data.
|
inlineexplicitconstexpr |
The CTList may be explicitly converted to underlying tuple type.
This conversion does copy data.
The CTList may be explicitly converted to reference to it's data.
This conversion doesn't copy data.
|
inline |
|
inline |
|
inlinestaticconstexpr |
Length of CTList.
|
inlinestatic |
Calls a function for each CTList item which is not marked inactive for the provided bitset.
The foreach function doesn't return anything.
FArgs | types of arguments, should be deduced automatically. |
fargs | arguments list passed to a function. The firs one is the bitset marking active items passed as int. The second one should be a function which returns void and takes one of the following
|
|
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 a function for each CTList's item type which is not marked inactive in the provided bitset and store results in std::array.
Function is disabled for empty CTList.
FArgs | types of arguments, should be deduced automatically. |
fargs | function arguments list. The first argument must be a fallback value, which would be returned in case std::ignore appeared in the list. The second argument is the bitset (passed as int number). The third argument is a function (callable object) which has a call operator which can take one of the following
|