Chunked-sequence is a sequence-container which uses a list of large blocks ("chunks") to ensure very fast append times at the expense of only permitting bi-directional iterators: random access is not supported, unlike std::deque<> or std::vector<>.
More...
#include <chunked_sequence.hpp>
|
|
using | value_type = T |
| |
|
using | size_type = std::size_t |
| |
|
using | difference_type = std::ptrdiff_t |
| |
|
using | reference = value_type & |
| |
|
using | const_reference = value_type const & |
| |
|
using | pointer = T * |
| |
|
using | const_pointer = T const * |
| |
|
using | iterator = iterator_base< false > |
| |
|
using | const_iterator = iterator_base< true > |
| |
|
using | chunk_list = std::list< chunk > |
| |
|
|
| chunked_sequence (chunked_sequence const &)=delete |
| |
|
| chunked_sequence (chunked_sequence &&other) noexcept |
| |
|
chunked_sequence & | operator= (chunked_sequence const &other) noexcept=delete |
| |
|
chunked_sequence & | operator= (chunked_sequence &&other) noexcept |
| |
|
constexpr bool | empty () const noexcept |
| |
|
constexpr size_type | size () const noexcept |
| |
|
iterator | begin () noexcept |
| |
|
const_iterator | begin () const noexcept |
| |
|
const_iterator | cbegin () const noexcept |
| |
|
iterator | end () noexcept |
| |
|
const_iterator | end () const noexcept |
| |
|
const_iterator | cend () const noexcept |
| |
|
chunk_list::iterator | chunks_begin () noexcept |
| |
|
chunk_list::const_iterator | chunks_begin () const noexcept |
| |
|
chunk_list::const_iterator | chunks_cbegin () noexcept |
| |
|
chunk_list::iterator | chunks_end () noexcept |
| |
|
chunk_list::const_iterator | chunks_end () const noexcept |
| |
|
chunk_list::const_iterator | chunks_cend () noexcept |
| |
|
std::size_t | chunks_size () const noexcept |
| |
|
void | clear () |
| |
|
void | reserve (std::size_t const) |
| |
| std::size_t | capacity () const noexcept |
| | Returns the number of elements that the container has currently allocated space for. More...
|
| |
| void | resize (size_type count) |
| | Resizes the container to contain count elements. More...
|
| |
|
template<typename... Args> |
| reference | emplace_back (Args &&... args) |
| |
|
reference | push_back (T const &value) |
| |
|
reference | push_back (T &&value) |
| |
| reference | front () |
| | Returns a reference to the first element in the container. More...
|
| |
| const_reference | front () const |
| | Returns a reference to the first element in the container. More...
|
| |
| reference | back () |
| | Returns a reference to the last element in the container. More...
|
| |
| const_reference | back () const |
| | Returns a reference to the last element in the container. More...
|
| |
|
void | swap (chunked_sequence &other) noexcept |
| |
|
void | splice (chunked_sequence &&other) |
| |
|
template<typename... Args> |
| auto | emplace_back (Args &&... args) -> reference |
| |
|
|
static constexpr std::size_t | elements_per_chunk = ElementsPerChunk |
| | The number of elements in an individual chunk.
|
| |
template<typename T, std::size_t ElementsPerChunk = std::max (4096 / sizeof (T), std::size_t{1}), std::size_t ActualSize = sizeof (T), std::size_t ActualAlign = alignof (T)>
class pstore::chunked_sequence< T, ElementsPerChunk, ActualSize, ActualAlign >
Chunked-sequence is a sequence-container which uses a list of large blocks ("chunks") to ensure very fast append times at the expense of only permitting bi-directional iterators: random access is not supported, unlike std::deque<> or std::vector<>.
Each chunk has storage for a number of objects. This number is a compile-time constant and is usually reasonably large and chosen so that the memory required is a multiple of the VM page size. Appending is performed in amortized constant time where we either bump a pointer in an existing chunk or allocate a new one. Unlike std::vector<>, no moving or copying occurs after append, and only the past-the-end iterator is invalidated.
- Template Parameters
-
| T | The type of the elements. |
| ElementsPerChunk | The number of elements in an individual chunk. |
| ActualSize | The storage allocated to an individual element. Normally equal to sizeof(T), this can be increased to allow for dynamically-sized types. |
| ActualAlign | The alignment of an individual element. Normally equal to alignof(T). |
◆ back() [1/2]
template<typename T, std::size_t ElementsPerChunk = std::max (4096 / sizeof (T), std::size_t{1}), std::size_t ActualSize = sizeof (T), std::size_t ActualAlign = alignof (T)>
Returns a reference to the last element in the container.
Calling back on an empty container is undefined.
◆ back() [2/2]
template<typename T, std::size_t ElementsPerChunk = std::max (4096 / sizeof (T), std::size_t{1}), std::size_t ActualSize = sizeof (T), std::size_t ActualAlign = alignof (T)>
Returns a reference to the last element in the container.
Calling back on an empty container is undefined.
◆ capacity()
template<typename T, std::size_t ElementsPerChunk = std::max (4096 / sizeof (T), std::size_t{1}), std::size_t ActualSize = sizeof (T), std::size_t ActualAlign = alignof (T)>
Returns the number of elements that the container has currently allocated space for.
- Returns
- Capacity of the currently allocated storage.
◆ front() [1/2]
template<typename T, std::size_t ElementsPerChunk = std::max (4096 / sizeof (T), std::size_t{1}), std::size_t ActualSize = sizeof (T), std::size_t ActualAlign = alignof (T)>
Returns a reference to the first element in the container.
Calling front on an empty container is undefined.
◆ front() [2/2]
template<typename T, std::size_t ElementsPerChunk = std::max (4096 / sizeof (T), std::size_t{1}), std::size_t ActualSize = sizeof (T), std::size_t ActualAlign = alignof (T)>
Returns a reference to the first element in the container.
Calling front on an empty container is undefined.
◆ resize()
template<typename T, std::size_t ElementsPerChunk = std::max (4096 / sizeof (T), std::size_t{1}), std::size_t ActualSize = sizeof (T), std::size_t ActualAlign = alignof (T)>
Resizes the container to contain count elements.
If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional default-inserted elements are appended.
- Parameters
-
| count | The new size of the container. |
The documentation for this class was generated from the following file: