0.4.1
Loading...
Searching...
No Matches
CartesianProduct.hpp File Reference

Algorithm iterating all combinations of a list. More...

Go to the source code of this file.

Data Structures

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...
 

Namespaces

namespace  NAV
 
namespace  NAV::CartesianProduct
 
namespace  NAV::CartesianProduct::tuple_algos
 

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>
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.
 

Detailed Description

Algorithm iterating all combinations of a list.

Author
T. Topp (topp@.nosp@m.ins..nosp@m.uni-s.nosp@m.tutt.nosp@m.gart..nosp@m.de)
Date
2022-11-04
Note
Original code by Jonathan Boccara from https://www.fluentcpp.com/2022/03/18/how-to-generate-all-the-combinations-from-several-collections/

Definition in file CartesianProduct.hpp.