0.2.0
|
Algorithm iterating all combinations of a list. More...
Go to the source code of this file.
Classes | |
struct | NAV::CartesianProduct::increment_iterator< I > |
Helper struct to increment an iterator. More... | |
struct | NAV::CartesianProduct::increment_iterator< 0 > |
Helper struct to increment an iterator. More... | |
Functions | |
template<typename Tuple , typename Predicate > | |
bool | NAV::CartesianProduct::tuple_algos::any_of (Tuple &&tuple, Predicate pred) |
Any_of algorithm for tuples. | |
template<typename Function , typename... Ts, size_t... Is> | |
void | NAV::CartesianProduct::callFunction (Function function, std::tuple< Ts... > const &tuple, std::index_sequence< Is... >) |
Calls the function on the tuple. | |
template<typename Function , typename... Ranges> | |
void | NAV::cartesian_product (Function function, Ranges const &... ranges) |
Calls a function on all combinations over ranges. | |
template<typename SubList , size_t N, typename Function > | |
void | NAV::cartesian_product (Function function, std::array< SubList, N > list) |
Calls a function on all combinations over ranges defined in an array, e.g. std::array<std::vector> | |
template<typename SubList , size_t N, typename Function > | |
void | NAV::cartesian_product_idx (Function function, std::array< SubList, N > list) |
Calls a function on all combinations over ranges defined in an array, e.g. std::array<std::vector>. Instead of providing the list entry to the function, provides the index of it in the sub list. | |
template<typename... Ts> | |
auto | NAV::CartesianProduct::dereference (std::tuple< Ts... > const &tuple) |
Dereference a tuple. | |
template<typename Tuple , typename Predicate > | |
size_t | NAV::CartesianProduct::tuple_algos::find_if (Tuple &&tuple, Predicate pred) |
Find_if for tuples. | |
template<class F , class Tuple > | |
constexpr decltype(auto) | NAV::CartesianProduct::tuple_algos::for_each (Tuple &&t, F &&f) |
For-each algorithm for tuples. | |
template<class Tuple , class F , std::size_t... I> | |
F | NAV::CartesianProduct::tuple_algos::for_each_impl (Tuple &&t, F &&f, std::index_sequence< I... >) |
For-each implementation for tuples. | |
template<typename... Iterators> | |
void | NAV::CartesianProduct::next_combination (std::tuple< Iterators... > &iterators, std::tuple< Iterators... > const &beginIterators, std::tuple< Iterators... > const &endIterators) |
Gets the next combination of the tuples of iterators. | |
template<typename... Ts, typename Function > | |
auto | NAV::CartesianProduct::tuple_algos::transform (std::tuple< Ts... > const &inputs, Function function) |
Transform algorithm for tuples. | |
template<class Tuple , class F , std::size_t... Is> | |
auto | NAV::CartesianProduct::tuple_algos::transform_impl (Tuple &&t, F &&f, std::index_sequence< Is... >) -> decltype(std::make_tuple(std::forward< F >(f)(std::get< Is >(std::forward< Tuple >(t)))...)) |
Transform implementation for tuples. | |
Algorithm iterating all combinations of a list.
bool NAV::CartesianProduct::tuple_algos::any_of | ( | Tuple && | tuple, |
Predicate | pred ) |
Any_of algorithm for tuples.
[in] | tuple | The tuple to search |
[in] | pred | Predicate to check for |
void NAV::CartesianProduct::callFunction | ( | Function | function, |
std::tuple< Ts... > const & | tuple, | ||
std::index_sequence< Is... > | ) |
Calls the function on the tuple.
[in] | function | Function to call |
[in] | tuple | Tuple to pass as argument |
void NAV::cartesian_product | ( | Function | function, |
Ranges const &... | ranges ) |
Calls a function on all combinations over ranges.
[in] | function | Function to call. Needs one parameter for each range given. Type of the parameter must be equal to the range type. |
[in] | ranges | Ranges to call the function on |
void NAV::cartesian_product | ( | Function | function, |
std::array< SubList, N > | list ) |
Calls a function on all combinations over ranges defined in an array, e.g. std::array<std::vector>
[in] | function | Function to call. Needs one parameter for each element in the array. Type of the parameter must be equal to the range type. |
[in] | list | List of ranges to call the function on |
void NAV::cartesian_product_idx | ( | Function | function, |
std::array< SubList, N > | list ) |
Calls a function on all combinations over ranges defined in an array, e.g. std::array<std::vector>. Instead of providing the list entry to the function, provides the index of it in the sub list.
[in] | function | Function to call. Needs one 'size_t' parameter for each element in the array |
[in] | list | List of ranges to call the function on |
auto NAV::CartesianProduct::dereference | ( | std::tuple< Ts... > const & | tuple | ) |
Dereference a tuple.
[in] | tuple | Tuple to dereference |
size_t NAV::CartesianProduct::tuple_algos::find_if | ( | Tuple && | tuple, |
Predicate | pred ) |
Find_if for tuples.
[in] | tuple | The tuple to search |
[in] | pred | Predicate to use for finding |
|
constexpr |
For-each algorithm for tuples.
[in] | t | The tuple |
[in] | f | Function to call |
F NAV::CartesianProduct::tuple_algos::for_each_impl | ( | Tuple && | t, |
F && | f, | ||
std::index_sequence< I... > | ) |
For-each implementation for tuples.
[in] | t | The tuple |
[in] | f | Function to call |
void NAV::CartesianProduct::next_combination | ( | std::tuple< Iterators... > & | iterators, |
std::tuple< Iterators... > const & | beginIterators, | ||
std::tuple< Iterators... > const & | endIterators ) |
Gets the next combination of the tuples of iterators.
[in] | iterators | The iterator to get the next combination for |
[in] | beginIterators | Beginning of the Iterators |
[in] | endIterators | End of the Iterators |
auto NAV::CartesianProduct::tuple_algos::transform | ( | std::tuple< Ts... > const & | inputs, |
Function | function ) |
Transform algorithm for tuples.
[in] | inputs | Input tuple |
[in] | function | Function to call |
auto NAV::CartesianProduct::tuple_algos::transform_impl | ( | Tuple && | t, |
F && | f, | ||
std::index_sequence< Is... > | ) -> decltype(std::make_tuple(std::forward<F>(f)(std::get<Is>(std::forward<Tuple>(t)))...)) |
Transform implementation for tuples.
[in] | t | Tuple |
[in] | f | Function to call |