|
PMDK C++ bindings
1.2.0
This is the C++ bindings documentation for PMDK's libpmemobj.
|
pmem::obj::experimental::vector - EXPERIMENTAL persistent container with std::vector compatible interface. More...
#include <libpmemobj++/experimental/vector.hpp>
Public Member Functions | |
| vector () | |
| Default constructor. More... | |
| vector (size_type count, const value_type &value) | |
| Constructs the container with count copies of elements with value value. More... | |
| vector (size_type count) | |
| Constructs the container with count copies of T default constructed values. More... | |
| template<typename InputIt , typename std::enable_if< detail::is_input_iterator< InputIt >::value &&std::is_constructible< value_type, typename std::iterator_traits< InputIt >::reference >::value, InputIt >::type * = nullptr> | |
| vector (InputIt first, InputIt last) | |
| Constructs the container with the contents of the range [first, last). More... | |
| vector (const vector &other) | |
| Copy constructor. More... | |
| vector (vector &&other) | |
| Move constructor. More... | |
| vector (std::initializer_list< T > init) | |
| Constructs the container with the contents of the initializer list init. More... | |
| ~vector () | |
| Destructor. More... | |
| reference | at (size_type n) |
| Access element at specific index with bounds checking and add it to a transaction. More... | |
| const_reference | at (size_type n) const |
| Access element at specific index with bounds checking. More... | |
| const_reference | const_at (size_type n) const |
| Access element at specific index with bounds checking. More... | |
| reference | operator[] (size_type n) |
| Access element at specific index and add it to a transaction. More... | |
| const_reference | operator[] (size_type n) const |
| Access element at specific index. More... | |
| reference | front () |
| Access the first element and add this element to a transaction. More... | |
| const_reference | front () const |
| Access the first element. More... | |
| const_reference | cfront () const |
| Access the first element. More... | |
| reference | back () |
| Access the last element and add this element to a transaction. More... | |
| const_reference | back () const |
| Access the last element. More... | |
| const_reference | cback () const |
| Access the last element. More... | |
| value_type * | data () |
| Returns raw pointer to the underlying data and adds entire array to a transaction. More... | |
| const value_type * | data () const noexcept |
| Returns const raw pointer to the underlying data. More... | |
| const value_type * | cdata () const noexcept |
| Returns const raw pointer to the underlying data. More... | |
| iterator | begin () |
| Returns an iterator to the beginning. More... | |
| const_iterator | begin () const noexcept |
| Returns const iterator to the beginning. More... | |
| const_iterator | cbegin () const noexcept |
| Returns const iterator to the beginning. More... | |
| iterator | end () |
| Returns an iterator to past the end. More... | |
| const_iterator | end () const noexcept |
| Returns a const iterator to past the end. More... | |
| const_iterator | cend () const noexcept |
| Returns a const iterator to the end. More... | |
| reverse_iterator | rbegin () |
| Returns a reverse iterator to the beginning. More... | |
| const_reverse_iterator | rbegin () const noexcept |
| Returns a const reverse iterator to the beginning. More... | |
| const_reverse_iterator | crbegin () const noexcept |
| Returns a const reverse iterator to the beginning. More... | |
| reverse_iterator | rend () |
| Returns a reverse iterator to the end. More... | |
| const_reverse_iterator | rend () const noexcept |
| Returns a const reverse iterator to the end. More... | |
| const_reverse_iterator | crend () const noexcept |
| Returns a const reverse iterator to the beginning. More... | |
| constexpr bool | empty () const noexcept |
| Checks whether the container is empty. More... | |
| size_type | size () const noexcept |
| constexpr size_type | max_size () const noexcept |
| size_type | capacity () const noexcept |
| void | free_data () |
| Clears the content of a vector and frees all allocated persitent memory for data in transaction. More... | |
Private Member Functions | |
| void | _alloc (size_type size) |
| Private helper function. More... | |
| void | _dealloc () |
| Private helper function. More... | |
| void | _grow (size_type count, const_reference value) |
| Private helper function. More... | |
| template<typename InputIt , typename std::enable_if< detail::is_input_iterator< InputIt >::value &&std::is_constructible< value_type, typename std::iterator_traits< InputIt >::reference >::value, InputIt >::type * = nullptr> | |
| void | _grow (InputIt first, InputIt last) |
| Private helper function. More... | |
| void | _shrink (size_type size_new) noexcept |
| Private helper function. More... | |
pmem::obj::experimental::vector - EXPERIMENTAL persistent container with std::vector compatible interface.
| pmem::obj::experimental::vector< T >::vector | ( | ) |
Default constructor.
Constructs an empty container.
| pmem::pool_error | if an object is not in persistent memory. |
| pmem::transaction_error | if constructor wasn't called in transaction. |
| pmem::obj::experimental::vector< T >::vector | ( | size_type | count, |
| const value_type & | value | ||
| ) |
Constructs the container with count copies of elements with value value.
| [in] | count | number of elements to construct. |
| [in] | value | value of all constructed elements. |
| pmem::pool_error | if an object is not in persistent memory. |
| pmem::transaction_alloc_error | when allocating memory for underlying array in transaction failed. |
| pmem::transaction_error | if constructor wasn't called in transaction. |
| rethrows | element constructor exception. |
|
explicit |
Constructs the container with count copies of T default constructed values.
| [in] | count | number of elements to construct. |
| pmem::pool_error | if an object is not in persistent memory. |
| pmem::transaction_alloc_error | when allocating memory for underlying array in transaction failed. |
| pmem::transaction_error | if constructor wasn't called in transaction. |
| rethrows | element constructor exception. |
| pmem::obj::experimental::vector< T >::vector | ( | InputIt | first, |
| InputIt | last | ||
| ) |
Constructs the container with the contents of the range [first, last).
The first and last arguments must satisfy InputIterator requirements. This overload only participates in overload resolution if InputIt satisfies InputIterator, to avoid ambiguity with the overload of count-value constructor.
| [in] | first | first iterator. |
| [in] | last | last iterator. |
| pmem::pool_error | if an object is not in persistent memory. |
| pmem::transaction_alloc_error | when allocating memory for underlying array in transaction failed. |
| pmem::transaction_error | if constructor wasn't called in transaction. |
| rethrows | element constructor exception. |
| pmem::obj::experimental::vector< T >::vector | ( | const vector< T > & | other | ) |
Copy constructor.
Constructs the container with the copy of the contents of other.
| [in] | other | reference to the vector to be copied. |
| pmem::pool_error | if an object is not in persistent memory. |
| pmem::transaction_alloc_error | when allocating memory for underlying array in transaction failed. |
| pmem::transaction_error | if constructor wasn't called in transaction. |
| rethrows | element constructor exception. |
| pmem::obj::experimental::vector< T >::vector | ( | vector< T > && | other | ) |
Move constructor.
Constructs the container with the contents of other using move semantics. After the move, other is guaranteed to be empty().
| [in] | other | rvalue reference to the vector to be moved from. |
| pmem::pool_error | if an object is not in persistent memory. |
| pmem::transaction_error | if constructor wasn't called in transaction. |
| pmem::obj::experimental::vector< T >::vector | ( | std::initializer_list< T > | init | ) |
Constructs the container with the contents of the initializer list init.
| [in] | init | initializer list with content to be constructed. |
| pmem::pool_error | if an object is not in persistent memory. |
| pmem::transaction_alloc_error | when allocating memory for underlying array in transaction failed. |
| pmem::transaction_error | if constructor wasn't called in transaction. |
| rethrows | element constructor exception. |
| pmem::obj::experimental::vector< T >::~vector | ( | ) |
Destructor.
Note that free_data may throw an transaction_free_error when freeing underlying array failed. It is recommended to call free_data manually before object destruction.
|
private |
Private helper function.
Must be called during transaction. Allocates memory for given number of elements.
| [in] | capacity_new | capacity of new underlying array. |
| std::length_error | if new size exceeds biggest possible pmem allocation. |
| pmem::transaction_alloc_error | when allocating memory for underlying array in transaction failed. |
|
private |
Private helper function.
Must be called during transaction. Deallocates underlying array.
| pmem::transaction_free_error | when freeing old underlying array failed. |
|
private |
Private helper function.
Must be called during transaction. Assumes that there is enough space for additional elements. Copy constructs elements at the end of underlying array based on given parameters.
| [in] | count | number of elements to construct. |
| [in] | value | value of all constructed elements. |
| rethrows | constructor exception. |
|
private |
Private helper function.
Must be called during transaction. Assumes that there is enough space for additional elements and input arguments satisfy InputIterator requirements. Constructs elements in underlying array with the contents of the range [first, last). The first and last arguments must satisfy InputIterator requirements. This overload participates in overload resolution only if InputIt satisfies InputIterator.
| [in] | first | first iterator. |
| [in] | last | last iterator. |
| rethrows | constructor exception. |
|
privatenoexcept |
Private helper function.
Must be called during transaction. Destroys elements in underlying array beginning from position size_new.
| [in] | size_new | new size |
| vector< T >::reference pmem::obj::experimental::vector< T >::at | ( | size_type | n | ) |
Access element at specific index with bounds checking and add it to a transaction.
| [in] | n | index number. |
| std::out_of_range | if n is not within the range of the container. |
| pmem::transaction_error | when adding the object to the transaction failed. |
| vector< T >::const_reference pmem::obj::experimental::vector< T >::at | ( | size_type | n | ) | const |
Access element at specific index with bounds checking.
| [in] | n | index number. |
| std::out_of_range | if n is not within the range of the container. |
| vector< T >::reference pmem::obj::experimental::vector< T >::back | ( | ) |
Access the last element and add this element to a transaction.
| pmem::transaction_error | when adding the object to the transaction failed. |
| vector< T >::const_reference pmem::obj::experimental::vector< T >::back | ( | ) | const |
Access the last element.
| vector< T >::iterator pmem::obj::experimental::vector< T >::begin | ( | ) |
Returns an iterator to the beginning.
|
noexcept |
Returns const iterator to the beginning.
|
noexcept |
| vector< T >::const_reference pmem::obj::experimental::vector< T >::cback | ( | ) | const |
|
noexcept |
|
noexcept |
|
noexcept |
| vector< T >::const_reference pmem::obj::experimental::vector< T >::cfront | ( | ) | const |
| vector< T >::const_reference pmem::obj::experimental::vector< T >::const_at | ( | size_type | n | ) | const |
Access element at specific index with bounds checking.
In contradiction to at(), const_at() will return const_reference not depending on the const-qualification of the object it is called on. std::vector doesn't provide const_at() method.
| [in] | n | index number. |
| std::out_of_range | if n is not within the range of the container. |
|
noexcept |
|
noexcept |
Returns a const reverse iterator to the beginning.
In contradiction to rend(), crend() will return const_reverse_iterator not depending on the const-qualification of the object it is called on.
| vector< T >::value_type * pmem::obj::experimental::vector< T >::data | ( | ) |
Returns raw pointer to the underlying data and adds entire array to a transaction.
| pmem::transaction_error | when adding the object to the transaction failed. |
|
noexcept |
Returns const raw pointer to the underlying data.
|
noexcept |
Checks whether the container is empty.
| vector< T >::iterator pmem::obj::experimental::vector< T >::end | ( | ) |
Returns an iterator to past the end.
|
noexcept |
Returns a const iterator to past the end.
| void pmem::obj::experimental::vector< T >::free_data | ( | ) |
Clears the content of a vector and frees all allocated persitent memory for data in transaction.
| pmem::transaction_free_error | when freeing underlying array failed. |
| vector< T >::reference pmem::obj::experimental::vector< T >::front | ( | ) |
Access the first element and add this element to a transaction.
| pmem::transaction_error | when adding the object to the transaction failed. |
| vector< T >::const_reference pmem::obj::experimental::vector< T >::front | ( | ) | const |
Access the first element.
|
noexcept |
| vector< T >::reference pmem::obj::experimental::vector< T >::operator[] | ( | size_type | n | ) |
Access element at specific index and add it to a transaction.
No bounds checking is performed.
| [in] | n | index number. |
| pmem::transaction_error | when adding the object to the transaction failed. |
| vector< T >::const_reference pmem::obj::experimental::vector< T >::operator[] | ( | size_type | n | ) | const |
Access element at specific index.
No bounds checking is performed.
| [in] | n | index number. |
| vector< T >::reverse_iterator pmem::obj::experimental::vector< T >::rbegin | ( | ) |
Returns a reverse iterator to the beginning.
|
noexcept |
Returns a const reverse iterator to the beginning.
| vector< T >::reverse_iterator pmem::obj::experimental::vector< T >::rend | ( | ) |
Returns a reverse iterator to the end.
|
noexcept |
Returns a const reverse iterator to the end.
|
noexcept |
1.8.14