Is there a C++11 implementation/library publicly available that offers a container of tuples where each tuple element is stored in its own flat container?
What I am looking for is something like this
struct A { using type = double; };
struct B { using type = int; };
struct C { using type = int; };
std::size_t num_elements = 6;
flat_tuple_container<A, B, C> c(num_elements);
where internally the allocated memory is contiguous for each of A
, B
, and C
's types, giving me a container that would internally like the following if I wrote it manually:
struct manual_cont {
std::vector<double> v1;
std::vector<int> v2;
std::vector<int> v3;
};
Ideally, I would be able to access the flat_tuple_container
either element-wise, e.g.
c.get<A>(3) = 4.4;
if I need the raw performance of contiguous memory, or tuple-wise, e.g.
auto t = c[3];
get<A>(t) = 4.4;
if I need the convenience of treating the nth entry of the container as a struct/class instance.