{"id":20594769,"url":"https://github.com/celtera/ahsohtoa","last_synced_at":"2025-07-13T20:35:24.145Z","repository":{"id":113631171,"uuid":"424230090","full_name":"celtera/ahsohtoa","owner":"celtera","description":"Structure-of-array synthesis in C++20","archived":false,"fork":false,"pushed_at":"2022-05-27T09:05:32.000Z","size":28,"stargazers_count":81,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-14T23:36:58.948Z","etag":null,"topics":["cplusplus","cplusplus-20","game-development","gamedev","structure-of-arrays"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/celtera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-03T13:16:02.000Z","updated_at":"2025-04-04T13:12:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a24c3d0-62a4-46ef-ac37-c6a5d7416c7b","html_url":"https://github.com/celtera/ahsohtoa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/celtera/ahsohtoa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celtera%2Fahsohtoa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celtera%2Fahsohtoa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celtera%2Fahsohtoa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celtera%2Fahsohtoa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/celtera","download_url":"https://codeload.github.com/celtera/ahsohtoa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celtera%2Fahsohtoa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265200493,"owners_count":23726841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cplusplus","cplusplus-20","game-development","gamedev","structure-of-arrays"],"created_at":"2024-11-16T08:10:08.638Z","updated_at":"2025-07-13T20:35:24.138Z","avatar_url":"https://github.com/celtera.png","language":"C++","funding_links":["https://github.com/sponsors/jcelerier"],"categories":[],"sub_categories":[],"readme":"# ahsohtoa - automatic AoS-to-SoA\n\n![C++](https://img.shields.io/badge/language-c%2B%2B-green) [![Sponsor](https://img.shields.io/github/sponsors/jcelerier)](https://github.com/sponsors/jcelerier) ![License](https://img.shields.io/badge/license-GPLv3-brightgreen)  ![Platforms](https://img.shields.io/badge/platforms-all-blue)\n\nAutomatic structure-of-array generation for C++20: this library\ntakes a structure such as:\n\n```C++\nstruct Foo {\n  int a;\n  float b;\n  struct Bar {\n    float x;\n    char y;\n  } c;\n};\n```\n\nand, given:\n```C++\nahso::arrays\u003cstd::vector, Foo\u003e storage_direct;\n\nahso::recursive_arrays\u003cstd::vector, Foo\u003e storage_recursive;\n```\n\nwill respectively synthesize types which look like:\n```C++\n// for storage_direct: \nstd::tuple\u003cstd::vector\u003cint\u003e, std::vector\u003cfloat\u003e, std::vector\u003cBar\u003e\u003e\n\n// for storage_recursive: \nstd::tuple\u003cstd::vector\u003cint\u003e, std::vector\u003cfloat\u003e, std::vector\u003cfloat\u003e, std::vector\u003cchar\u003e\u003e \n```\n\n## Dependencies\n\n- Boost.PFR\n- C++20\n\n## Simple example\n\n```C++\nstruct vec3 { float x,y,z; };\nstruct color { float r,g,b,a; };\nstruct physics_component {\n  vec3 position;\n  vec3 speed;\n  vec3 acceleration;\n};\n\nstruct render_component {\n  color col;\n};\n\nstruct entity {\n  physics_component physics;\n  render_component render;\n}\n\nint main()\n{\n  // Define our storage\n  ahso::arrays\u003cstd::vector, entity\u003e e;\n\n  // Preallocate some space like you would with std::vector\n  e.reserve(1000);\n\n  // Add a new entity\n  auto index = e.add_entity({\n    .physics {\n      .position { 0., 0., 0. }\n    , .acceleration { 1., 0., 0. }\n    },\n    .render {\n      .col { 0., 1., 0., 1. }\n    }\n  });\n\n  // Access a specific component for entity \"index\"\n  e.get\u003cphysics_component\u003e(index).position.x = 2;\n  \n  // Or if the proper type is provided (until we get metaclasses, see example): \n  e[index].physics.position.x = 2;\n\n  // Remove an entity\n  e.erase(index);\n}\n```\n\n## Example with all the features\n\nSee https://github.com/celtera/ahsohtoa/blob/main/tests/test.cpp !\n\n# Licensing\n\nThe library is licensed under GPLv3 + [commercial](https://celtera.dev/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceltera%2Fahsohtoa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fceltera%2Fahsohtoa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceltera%2Fahsohtoa/lists"}