https://github.com/celtera/ahsohtoa Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} celtera / ahsohtoa Public * Notifications * Star 14 * Fork 0 * Structure-of-array synthesis in C++20 View license 14 stars 0 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 0 tags Code Latest commit @jcelerier jcelerier [docs] Improve readme ... c135147 Nov 3, 2021 [docs] Improve readme c135147 Git stats * 8 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time include/ahsohtoa [docs] Add extensive code documentation Nov 3, 2021 tests [recursive] Add nice syntax for adding entities Nov 3, 2021 .clang-format First commit Nov 3, 2021 .gitignore [recursive] Add support for reference_type Nov 3, 2021 LICENSE First commit Nov 3, 2021 README.md [docs] Improve readme Nov 3, 2021 View code ahsohtoa - automatic AoS-to-SoA Dependencies Simple example Example with all the features Licensing README.md ahsohtoa - automatic AoS-to-SoA C++ Sponsor License Platforms Automatic structure-of-array generation for C++20: this library takes a structure such as: struct Foo { int a; float b; struct Bar { float x; char y; } c; }; and, given: ahso::arrays storage_direct; ahso::recursive_arrays storage_recursive; will respectively synthesize types which look like: // for storage_direct: std::tuple, std::vector, std::vector> // for storage_recursive: std::tuple, std::vector, std::vector, std::vector> Dependencies * Boost.PFR * C++20 Simple example struct vec3 { float x,y,z; }; struct color { float r,g,b,a; }; struct physics_component { vec3 position; vec3 speed; vec3 acceleration; }; struct render_component { color col; }; struct entity { physics_component physics; render_component render; } int main() { // Define our storage ahso::arrays e; // Preallocate some space like you would with std::vector e.reserve(1000); // Add a new entity auto index = e.add_entity({ .physics { .position { 0., 0., 0. } , .acceleration { 1., 0., 0. } }, .render { .col { 0., 1., 0., 1. } } }); // Access a specific component for entity "index" e.get(index).position.x = 2; // Or if the proper type is provided (until we get metaclasses, see example): e[index].physics.position.x = 2; // Remove an entity e.erase(index); } Example with all the features See https://github.com/celtera/ahsohtoa/blob/main/tests/test.cpp ! Licensing The library is licensed under GPLv3 + commercial. About Structure-of-array synthesis in C++20 Topics gamedev cplusplus game-development cplusplus-20 structure-of-arrays Resources Readme License View license Releases No releases published Packages 0 No packages published Languages * C++ 100.0% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.