Structure-of-array synthesis in C++20

Overview

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
   <
   int>, std::vector<
   float>, std::vector
   
    >


    // for storage_recursive: 
std::tuple
    
     <
     int>, std::vector<
     float>, std::vector<
     float>, std::vector<
     char>> 
    
   
  

Dependencies

  • Boost.PFR
  • C++20

Simple example

(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); } ">
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.

Owner
celtera
celtera
Random access array of tightly packed unsigned integers

PackedArray: random access array of tightly packed unsigned integers TLDR PackedArray comes to the rescue when you're in a desperate need for an uint9

Gregory Pakosz 131 Jun 22, 2022
libsais is a library for linear time suffix array and burrows wheeler transform construction based on induced sorting algorithm.

libsais libsais is a library for fast (see Benchmarks below) linear time suffix array and Burrows-Wheeler transform construction based on induced sort

Ilya Grebnov 93 Jul 26, 2022
A collection of array rotation algorithms.

The most commonly used rotation algorithms (aka block swaps) were documented around 1981 and haven't notably changed since. Below I'll describe severa

null 30 Jul 13, 2022
This algorithm is amazing and take a high performance to search something under array.

Sequential Binary Algorithm O(n) Algoritmo Este é um algoritmo de complexidade O(log n), que possui uma alta performance em percorrer um vetor de inte

Guilherme Serafim Kollet 1 Oct 26, 2021
180+ Algorithm & Data Structure Problems using C++

180+ Algorithm & Data Structure Problems using C++

Ravi Mandliya 4.9k Aug 5, 2022
Is a linear data structure with O(log n) searches and O(cbrt n) insertions and index lookups.

A binary cube is a linear data structure that contains a sorted two dimensional dynamic array of nodes which each point to a sorted array

null 22 Jul 13, 2022
Data Structure and Algorithms problems across various platforms.

Covering various practice problems of Arrays, Stacks, queue, tree, graph and different Algorithms. A collection of solutions for Data Structure and Algorithms problems across various platforms in different languages.

Nivedita Singh 44 Jul 2, 2022
Teaching materials for Algorithm Bootcamp: Data Structure.

Data Structure Materials Materials Topics Code Introduction to Data Structures Struct Pointer Dynamic Memory Allocation 00_intro_to_ds.cpp Linked List

pakgembus 50 Apr 6, 2022
The ultimate guide for data structure and algorithms

Quick Notes: For Arrays: (methods that can be applied) sorting and then doing something, hashtable, two pointers in a loop are some of the operations

Intervue 44 Jul 14, 2022
This project Orchid-Fst implements a fast text string dictionary search data structure: Finite state transducer (short for FST) in c++ language.This FST C++ open source project has much significant advantages.

Orchid-Fst 1. Project Overview This project Orchid-Fst implements a fast text string dictionary search data structure: Finite state transducer , which

Bin Ding 9 Jul 25, 2022
Total 21 math problem solved by c language with 4 types of functional reference. Also added circular repeated linked list system of Data structure.

C-ProblemSolve Total 21 math problem solved by c language with 4 types of functional reference. Also added circular repeated linked list system of Dat

MH Miyazi 3 Aug 28, 2021
🏅State-of-the-art learned data structure that enables fast lookup, predecessor, range searches and updates in arrays of billions of items using orders of magnitude less space than traditional indexes

The Piecewise Geometric Model index (PGM-index) is a data structure that enables fast lookup, predecessor, range searches and updates in arrays of bil

Giorgio Vinciguerra 611 Jul 30, 2022
Typesafe, Generic & Fastest Set Data structure implementation in C

Typesafe & Fast as fuck Set in C Key Features Extremely fast non-cryptographic hash algorithm XXHash Complete Typesafe APIs Double Hashing to avoid bo

Robus Gauli 4 Sep 6, 2021
A simple & stupid data structure library for C

HDataStruct - Hans' Data Structures Library A simple & stupid data structure library for C. Introduction This is a small C library containing several

Hans Wan 3 Oct 6, 2021
Hashmap data structure with string keys

Hashmap Library implementing the hash map data structure with open addressing, robin hood hashing more presicely, as a collision resolution strategy.

Elmo Moilanen 2 Jun 23, 2022
Data structure manipulation in C

data-structure Data structure manipulation in C This is a set of functions for handling a singly linked list Pros: easy to read and short. the linked

ghassenhd 1 Nov 27, 2021
This is a data structure repo written with C++

Data structures In CPP This repo contains many algorithms and data structures in C++. There will be an explanation for each algorithm/data structure.

Hoàng Nguyên 2 Oct 12, 2021
A simple repo with different data structure programs made in C.

Hacktoberfest 2021 - Expert This is an intermediate-level project to help you get started with your [hacktoberfest] (https://hacktoberfest.digitalocea

null 14 Jun 1, 2022
The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language.

The Synthesis ToolKit in C++ (STK) By Perry R. Cook and Gary P. Scavone, 1995--2021. This distribution of the Synthesis ToolKit in C++ (STK) contains

null 793 Jul 30, 2022
Display array is a board that sets 6 ST7735 display with a resolution of 80x160px in a linear array sharing the clock, data, rs, backlight pins together

The display array is a board that sets 6 ST7735 display with a resolution of 80x160px in a linear array sharing the clock, data, rs, backlight pins together, and leaving individual access to the cs lines of each display, This board allows you to display images with a resolution of 480x160px.

Josue Alejandro Gutierrez 62 Jul 18, 2022
Data Structure Studying Group: array, linked list, stack, queue, deque, tree, graph. Summary of these concepts are descripted in the markdown files.

DATA_STRUCTURE STUDY ?? CURRICULUM ✔️ Day1 array linked list ✔️ Day2 circular linked list double linked list polynomial addtion reverse linked list ✔️

Soyeon Kim 3 Jul 22, 2022
Easy and efficient audio synthesis in C++

Tonic Fast and easy audio synthesis in C++. Prefer coding to patching? Love clean syntax? Care about performance? That's how we feel too, and why we m

null 466 Jul 12, 2022
TensorVox is an application designed to enable user-friendly and lightweight neural speech synthesis in the desktop

TensorVox is an application designed to enable user-friendly and lightweight neural speech synthesis in the desktop, aimed at increasing accessibility to such technology.

null 134 Aug 9, 2022
A synthesis flow for hybrid processing-in-RRAM modes

reram-synthesis A synthesis flow for hybrid processing-in-ReRAM modes This project contains three parts: digital-synthesis: a synthesis flow for the d

Feng Wang 7 Nov 12, 2021
Model synthesis is a technique for generating 2D and 3D shapes from examples.

Model Synthesis Model synthesis is a technique for generating 2D and 3D shapes from examples. It is inspired by texture synthesis. Model synthesis was

Paul Merrell 70 Aug 2, 2022
Direct Digital Synthesis DDS with microcontroller

Direct Digital Synthesis DDS with microcontroller DDS is a cool thing. To understand how it works is even cooler. So I wrote a little tutorial about D

weigu 1 Oct 31, 2021
ManipNet: Neural Manipulation Synthesis with a Hand-Object Spatial Representation - SIGGRAPH 2021

ManipNet: Neural Manipulation Synthesis with a Hand-Object Spatial Representation - SIGGRAPH 2021 Dataset Code Demos Authors: He Zhang, Yuting Ye, Tak

HE ZHANG 186 Jul 23, 2022
A minimal header-only audio synthesis and processing library

Aurora A minimal header-only C++ audio synthesis and processing toolkit. Getting Started Aurora is a collection of header files which can be included

null 11 Apr 27, 2022
C++ library for audio and music analysis, description and synthesis, including Python bindings

Essentia Essentia is an open-source C++ library for audio analysis and audio-based music information retrieval released under the Affero GPL license.

Music Technology Group - Universitat Pompeu Fabra 2.2k Aug 8, 2022