Skip to content

A simple SoA (structure of arrays) class implemented with tuple and meta struct (WIP).

License

Notifications You must be signed in to change notification settings

horror-proton/StructureOfArrays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Structure of Arrays

A toy structure of arrays class in C++ 17, assuming types of elements are known at compile time.

Currently here are two implementations, the meta-struct version and std::tuple version.

Usage

using vec4 = std::array<float, 4>;

structure_of_arrays<vec4, vec4, float> particles;

particles.reserve(...);

particles.push_back(vec4{0.F, 0.F, 0.F, 0.F}, vec4{0.F, 0.F, 1.F, 0.F}, 2.F);
particles.push_back(...);
particles.push_back(...);

std::cout << particles.get<2>(0) << std::endl; // 2.0

particles.pop_back();

particles.insert(index, vec4{}, vec4{}, float{});

Alternatives

About

A simple SoA (structure of arrays) class implemented with tuple and meta struct (WIP).

Resources

License

Stars

Watchers

Forks

Languages