2 ms·
The thing is, in modern C++ you can fake a wrapper to access it like a pointer or reference. Of course it will not be high performance, but it can be done. (E
by AstralStorm 8y ago
The thing is, in modern C++ you can fake a wrapper to access it like a pointer or reference.
Of course it will not be high performance, but it can be done. (E
.g. Eigen library.)
- smitherfield 8y agoWhy wouldn't an implementation along these lines be performant? template<typename... Ts> class SoA : public tuple<vector<Ts>...> { // ... template<size_t... Is> tuple<Ts&...> subscript(size_t i, index_sequence<Is...>) { return {get<Is>(*this)[i]...}; } public: // ... auto operator[](size_t i) { return subscript(i, index_sequence_for<Ts...>{}); } };