Provides interface to access sequence of objects.
More...
#include <libpmemobj++/slice.hpp>
|
using | size_type = std::size_t |
|
using | iterator = Iterator |
|
using | reverse_iterator = std::reverse_iterator< iterator > |
|
using | reference = typename std::iterator_traits< iterator >::reference |
|
|
| slice (Iterator begin, Iterator end) |
| Constructor taking two iterators, which define a range. More...
|
|
| slice (const slice &other) noexcept=default |
| Defaulted copy constructor.
|
|
slice & | operator= (const slice &other) noexcept=default |
| Defaulted assignment operator.
|
|
iterator | begin () const noexcept |
|
iterator | end () const noexcept |
|
reverse_iterator | rbegin () const noexcept |
| Returns a reverse_iterator to the last element in the range. More...
|
|
reverse_iterator | rend () const noexcept |
| Returns a reverse_iterator to the first element in the range. More...
|
|
reference | at (size_type idx) |
| Access operator for a single element of slice. More...
|
|
reference | operator[] (size_type idx) |
| Subscript operator, providing access to a single element of the slice. More...
|
|
size_type | size () const |
| Returns total number of elements within slice's range. More...
|
|
template<typename Iterator>
class pmem::obj::slice< Iterator >
Provides interface to access sequence of objects.
It provides the view of any sequence of objects and it simplifies the access to that sequence, with the help of iterators. It's used e.g. in several data structures to deliver range
methods. As an example slice usage please see: pmem::obj::vector::range() .
Slice can be used with any iterator type that supports:
- indexing of elements - operator[],
- subtraction of two iterators - operator-(),
- pre-decrementing the iterator - operator--().
◆ slice()
template<typename Iterator >
Constructor taking two iterators, which define a range.
- Note
- These iterators have to support: operator[], operator-(), and operator--()
- Exceptions
-
std::out_of_range | if it_end < it_begin. |
◆ at()
template<typename Iterator >
Access operator for a single element of slice.
- Parameters
-
idx | index of selected element. |
- Exceptions
-
std::out_of_range | if idx is greater or equal to size. |
- Returns
- reference to a selected object.
◆ begin()
template<typename Iterator >
- Returns
- iterator to the beginning of the slice's range.
◆ end()
template<typename Iterator >
- Returns
- iterator to the end of the slice's range.
◆ operator[]()
template<typename Iterator >
Subscript operator, providing access to a single element of the slice.
It internally increments from begin iterator,
- Parameters
-
- Note
- No bounds checking is performed, so the iterator may become invalid.
- Returns
- reference to a selected object.
◆ rbegin()
template<typename Iterator >
Returns a reverse_iterator to the last element in the range.
Reverse iterators iterate backwards: increasing them moves them towards the beginning of the range.
- Returns
- reverse_iterator to the reverse beginning of the slice's range.
◆ rend()
template<typename Iterator >
Returns a reverse_iterator to the first element in the range.
Reverse iterators iterate backwards: increasing them moves them towards the beginning of the range.
- Returns
- reverse_iterator to the reverse end of the slice's range.
◆ size()
template<typename Iterator >
Returns total number of elements within slice's range.
- Returns
- size_type count of all elements.
The documentation for this class was generated from the following file: