C ++ container for non-migrated stored tuples

I'm looking for an option std::vectoror std::array tuples , where the elements of a tuple are placed without alternation in separate memory areas instead of alternating, as it would, for example, for std::vector<std::tuple<...>>.

Motives for this

  • Better control with alignment and in turn, higher productivity for vector optimization.
  • Prevents the need to unpack data elements when interacting with low-level CPU-GPU data transfer operations (for example, an array of vertices and colors) in OpenGL.

Iterators must create and return boost::tuple<> on the fly when dereferencing.

I know that not all STL member functions can be effectively supported in this container. For example, the STL container member function data()would have to dynamically zip combine all the individual arrays into a mutable dynamically created vector container and return its data ().

Has anyone built such a container for tables already?

+3
source share
2 answers

Boost.Iterator has what you describe:boost::zip_iterator

+4
source

How about creating a thin shell that supports iteration and a few other operations around tuple<vector, vector, vector>and presenting the data in this way? I do not know any standard container that provides the interface you need.

+1

All Articles