SIMD-aware container for product types. More...
#include <eve/module/algo/algo/container/soa_vector.hpp>
Required header: #include <eve/memory/soa_vector.hpp>
soa_vector is a container similar to std::vector
but optimized to store [product types](eve::product_type) using a Structure Of Array layout compatible with SIMD processing.
Type | Value type stored inside eve::soa_vector |
Public Types | |
Member types | |
using | value_type = Type |
Type of data stored in the container. | |
using | iterator = decltype(views::convert(storage_type{}.data() , as<value_type>{})) |
Iterator over the the stored Type. | |
using | const_iterator = decltype(views::convert(std::declval<storage_type const>().data(), as<value_type>{})) |
Const iterator over the the stored Type. | |
using | iterator_aligned = decltype(views::convert(storage_type{}.data_aligned(), as<value_type>{})) |
Iterator over the the stored Type using aligned data. | |
using | const_iterator_aligned = decltype(views::convert(std::declval<storage_type const>().data_aligned(), as<value_type>{})) |
Const iterator over the the stored Type using aligned data. | |
using | pointer = iterator |
Pointer to a eve::algo::views::zip_iterator over fields. | |
using | const_pointer = const_iterator |
Const pointer to a eve::algo::views::zip_iterator over fields. | |
using | pointer_aligned = iterator_aligned |
Aligned pointer to a eve::algo::views::zip_iterator over fields. | |
using | const_pointer_aligned = const_iterator_aligned |
Const aligned pointer to a eve::algo::views::zip_iterator over fields. | |
using | size_type = std::size_t |
Size type. | |
Public Member Functions | |
Constructors | |
soa_vector (Allocator a) | |
Constructs an empty container with a custom Allocator . | |
soa_vector () | |
Constructs an empty container. | |
soa_vector (size_type n, Allocator a) | |
Constructs the container with n default-inserted instances of Type and a custom Allocator . | |
soa_vector (size_type n) | |
Constructs the container with n default-inserted instances of Type . | |
soa_vector (no_init_t, size_type n, Allocator a) | |
Constructs the container with n default-inserted instances of Type and a custom Allocator . | |
soa_vector (no_init_t, size_type n) | |
Constructs the container with n default-inserted instances of Type . | |
soa_vector (size_type n, value_type v, Allocator a) | |
Constructs the container with n copies of elements with value value and a custom Allocator . | |
soa_vector (size_type n, value_type v) | |
Constructs the container with n copies of elements with value value. | |
soa_vector (std::initializer_list< Type > l, Allocator a) | |
Constructs the container with the contents of the initializer list l . | |
soa_vector (std::initializer_list< Type > l) | |
Constructs the container with the contents of the initializer list l . | |
Capacity | |
size_type | size () const noexcept |
Returns the number of elements in the container. | |
size_type | capacity () const noexcept |
Returns the number of elements that the container has currently allocated space for. | |
void | shrink_to_fit () |
Requests the removal of unused capacity. | |
bool | empty () const noexcept |
Checks if the container has no elements. | |
void | reserve (size_type n) |
Increase the capacity of the vector to a value that's greater or equal to n . | |
Element access | |
auto | data_aligned () |
Returns a zipped aligned pointer to the beginning. | |
auto | data_aligned () const |
Returns a zipped aligned pointer to the beginning. | |
auto | data () |
Returns a zipped pointer to the beginning. | |
auto | data () const |
Returns a constant zipped pointer to the beginning. | |
value_type | get (size_type i) const |
Returns the value of the i th element of the container. | |
void | set (size_type i, value_type const &v) |
Modify the value of the i th element of the container. | |
void | fill (value_type v) |
Fill the soa_vector with a given value. | |
Iterators | |
auto | begin_aligned () -> iterator_aligned |
Returns an aligned iterator to the beginning. | |
auto | begin_aligned () const -> const_iterator_aligned |
Returns an aligned iterator to the beginning. | |
auto | cbegin_aligned () const -> const_iterator_aligned |
Returns a constant aligned iterator to the beginning. | |
auto | begin () -> iterator |
Returns an iterator to the beginning. | |
auto | begin () const -> const_iterator |
Returns an iterator to the beginning. | |
auto | cbegin () const -> const_iterator |
Returns a constant iterator to the beginning. | |
auto | end () -> iterator |
Returns an iterator to the end. | |
auto | end () const -> const_iterator |
Returns an iterator to the end. | |
auto | cend () const -> const_iterator |
Returns a constant iterator to the end. | |
Friends | |
Comparisons and ordering | |
bool | operator== (soa_vector const &lhs, soa_vector const &rhs) |
Checks if the contents of lhs and rhs are equal. | |
bool | operator!= (soa_vector const &lhs, soa_vector const &rhs) |
Checks if the contents of lhs and rhs are not equal. | |
Modifiers | |
void | clear () |
Clear the contents of the container. | |
iterator | erase (const_iterator pos) |
Removes an element from the container. | |
iterator | erase (const_iterator f, const_iterator l) |
Removes the elements in the range [first, last) | |
void | push_back (value_type const &value) noexcept |
Appends the given element value to the end of the container. | |
void | pop_back () noexcept |
Removes the last element of the container. | |
void | resize (size_type n, value_type value) |
Resizes the container to contain count elements. | |
void | resize (size_type n) |
Resizes the current eve::soa_vector to a new size. | |
void | swap (soa_vector &other) noexcept |
Exchanges the contents of the container with those of other . | |
Allocator | get_allocator () |
Retrieves an instance of the current allocator. | |
void | swap (soa_vector &lhs, soa_vector &rhs) noexcept |
Swaps the contents of lhs and rhs by calling lhs.swap(rhs) . | |