I need to build a tuple of n types. These n types are value types of n other types. Consider this snippet:
#include <boost/hana.hpp>
namespace hana = boost::hana;
template<class... Types>
class CartesianProduct
{
public:
CartesianProduct(Types... args) : sets(args...) {}
hana::tuple<Types...> sets;
hana::tuple<Types...::value_type> combination; // does not work obviously... but wo can this be done?
};
The application of this is intended like so: I pass this class a parameter pack of containers of possibly different types. The class puts these containers into a tuple sets
. The class also has a field combination
which is a tuple of as many elements as containers were passed to the class. But the types of the elements are the value types of the different containers.
The class is then intended to lazyly build the cartesian product of the containers passed to it and store the current combination in combination
. But how can I actually get to the value types of the containers in a variadic fashion?
value_type
? – Othacartesian_product
lazily by itself. – Chatterton