|
pstore2
|
A sparse array type. More...
#include <sparse_array.hpp>
Classes | |
| class | indices |
Public Member Functions | |
| template<typename IteratorIdx , typename IteratorV > | |
| sparse_array (IteratorIdx first_index, IteratorIdx last_index, IteratorV first_value, IteratorV last_value) | |
| Constructs a sparse array whose available indices are defined by the iterator range from [first_index,last_index) and the values assigned to those indices are given by [FirstValue, LastValue). More... | |
| template<typename IteratorIdx > | |
| sparse_array (IteratorIdx first_index, IteratorIdx last_index) | |
| Constructs a sparse array whose available indices are defined by the iterator range from [first_index,last_index) and whose corresponding values are default constructed. More... | |
| sparse_array (sparse_array const &)=delete | |
| sparse_array (sparse_array &&) noexcept=delete | |
| sparse_array & | operator= (sparse_array const &)=delete |
| sparse_array & | operator= (sparse_array &&) noexcept=delete |
| void | fill (ValueType const &value) |
| constexpr std::size_t | size_bytes () const |
| void * | operator new (std::size_t const, void *const ptr) |
| void | operator delete (void *const, void *const) |
| void | operator delete (void *const p) |
Iterators | |
Returns an iterator to the beginning of the container. | |
| iterator | begin () |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| iterator | end () |
| const_iterator | end () const |
| const_iterator | cend () const |
| reverse_iterator | rbegin () |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | crbegin () const |
| reverse_iterator | rend () |
| const_reverse_iterator | rend () const |
| const_reverse_iterator | crend () const |
| indices | get_indices () const noexcept |
Element access | |
| ValueType * | data () noexcept |
| ValueType const * | data () const noexcept |
| reference | operator[] (size_type pos) noexcept |
| const_reference | operator[] (size_type pos) const noexcept |
| reference | at (size_type pos) |
| const_reference | at (size_type pos) const |
| constexpr reference | front () |
| Returns a reference to the first element in the container. More... | |
| constexpr const_reference | front () const |
| Returns a reference to the first element in the container. More... | |
| constexpr reference | back () |
| Returns a reference to the last element in the container. More... | |
| constexpr const_reference | back () const |
| Returns a reference to the last element in the container. More... | |
Static Public Member Functions | |
| template<typename IteratorIdx , typename IteratorV > | |
| static auto | make_unique (IteratorIdx first_index, IteratorIdx last_index, IteratorV first_value, IteratorV last_value) -> std::unique_ptr< sparse_array > |
| Constructs a sparse_array<> instance where the indices are extracted from an iterator range [first_index, last_index) and the values at each index are given by the range [first_value,last_value). More... | |
| template<typename IteratorIdx > | |
| static auto | make_unique (IteratorIdx first_index, IteratorIdx last_index, std::initializer_list< ValueType > values) -> std::unique_ptr< sparse_array > |
| template<typename Iterator > | |
| static auto | make_unique (Iterator begin, Iterator end) -> std::unique_ptr< sparse_array > |
| static auto | make_unique (std::initializer_list< size_type > indices, std::initializer_list< ValueType > values={}) -> std::unique_ptr< sparse_array > |
| static auto | make_unique (std::initializer_list< std::pair< size_type, ValueType >> v) -> std::unique_ptr< sparse_array > |
| static constexpr std::size_t | size_bytes (std::size_t const num_entries) noexcept |
Friends | |
| template<typename V , typename B > | |
| bool | operator== (sparse_array< V, B > const &lhs, sparse_array< V, B > const &rhs) |
Capacity | |
| constexpr bool | empty () const noexcept |
| constexpr size_type | size () const noexcept |
| constexpr bool | has_index (size_type pos) const noexcept |
| Returns true if the sparse array has an index 'pos'. | |
| static constexpr size_type | max_size () noexcept |
| Returns the maximum number of indices that could be contained by an instance of this sparse_array type. More... | |
A sparse array type.
A sparse array implementation which uses a bitmap value (whose type is given by the BitmapType template parameter) to manage the collection of members. Each position in that bitmap represents the presence or absence of a value at the corresponding index. A bitmap value of 1 would mean that a single element at index 0 is present; a bitmap value of 0b101 indices that members 0 and 2 are available. The array members are contiguous. The position of a specific index can be computed as: P(v & ((1 << x) - 1)) where P is the population count function, v is the bitmap-value, and x is the required index.
| pstore::sparse_array< ValueType, BitmapType >::sparse_array | ( | IteratorIdx | first_index, |
| IteratorIdx | last_index, | ||
| IteratorV | first_value, | ||
| IteratorV | last_value | ||
| ) |
Constructs a sparse array whose available indices are defined by the iterator range from [first_index,last_index) and the values assigned to those indices are given by [FirstValue, LastValue).
If the number of elements in [first_value, last_value) is less than the number of elements in [first_index,last_index), the remaining values are default-constructed; if it is greater then the remaining values are ignored.
| pstore::sparse_array< ValueType, BitmapType >::sparse_array | ( | IteratorIdx | first_index, |
| IteratorIdx | last_index | ||
| ) |
Constructs a sparse array whose available indices are defined by the iterator range from [first_index,last_index) and whose corresponding values are default constructed.
|
inline |
Returns a reference to the last element in the container.
Calling back() on an empty container is undefined.
|
inline |
Returns a reference to the last element in the container.
Calling back() on an empty container is undefined.
|
inline |
Returns a reference to the first element in the container.
Calling front() on an empty container is undefined.
|
inline |
Returns a reference to the first element in the container.
Calling front() on an empty container is undefined.
|
static |
Constructs a sparse_array<> instance where the indices are extracted from an iterator range [first_index, last_index) and the values at each index are given by the range [first_value,last_value).
The number of elements in each range must be the same.
|
inlinestaticnoexcept |
Returns the maximum number of indices that could be contained by an instance of this sparse_array type.
1.8.13