I’m looking for a variant of std::vector or std::array of tuples, where the tuple elements are placed non-interleaved into separate memory areas instead of interleaved as would be the case for, for example, a std::vector<std::tuple<...>>.
The motivations for this is
- Better control over alignment and in turn better performance for vector optimizations.
- Prevents us from having to unpack data-elements when interfacing low-level CPU-GPU data-transfer-operations (such as an array of vertices and colors) in OpenGL.
Iterators should construct and return a boost::tuple<> on-the-fly when dereferenced.
I’m aware that not all STL-member functions could be supported efficiently in this container. For example the STL data() container member function would have to dynamically zip together all the separate arrays into a mutable dynamically created vector container and return its data().
Has anybody constructed such a table container already?
Boost.Iterator has exactly what you describe:
boost::zip_iterator