protozero 1.7.1 Minimalistic protocol buffer decoder and encoder in C++.

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
protozero::iterator_range< T, P > Class Template Reference

`#include <iterators.hpp>`

Inheritance diagram for protozero::iterator_range< T, P >:
[legend]
Collaboration diagram for protozero::iterator_range< T, P >:
[legend]

## Public Types
using | iterator = T
| The type of the iterators in this range.
using | value_type = typename std::iterator_traits< T >::value_type
| The value type of the underlying iterator.

## Public Member Functions
constexpr | iterator_range ()
constexpr | iterator_range (iterator &&first_iterator, iterator &&last_iterator)
constexpr iterator | begin () const noexcept
| Return iterator to beginning of range.
constexpr iterator | end () const noexcept
| Return iterator to end of range.
constexpr iterator | cbegin () const noexcept
| Return iterator to beginning of range.
constexpr iterator | cend () const noexcept
| Return iterator to end of range.
constexpr bool | empty () const noexcept
std::size_t | size () const noexcept
value_type | front () const
void | drop_front ()
void | swap (iterator_range &other) noexcept

## Detailed Description

template<typename T, typename P = std::pair<T, T>>
class protozero::iterator_range< T, P >

A range of iterators based on std::pair. Created from beginning and end iterators. Used as a return type from some pbf_reader methods that is easy to use with range-based for loops.

## Constructor & Destructor Documentation

## ◆ iterator_range() [1/2]

template<typename T , typename P = std::pair<T, T>>

constexpr protozero::iterator_range< T, P >::iterator_range | ( |  | ) |
| inline constexpr

Default constructor. Create empty iterator_range.

## ◆ iterator_range() [2/2]

template<typename T , typename P = std::pair<T, T>>

constexpr protozero::iterator_range< T, P >::iterator_range | ( | iterator && | first_iterator,
|  | iterator && | last_iterator
| ) |  |
| inline constexpr

Create iterator range from two iterators.

Parameters

  first_iterator | Iterator to beginning of range.
  last_iterator | Iterator to end of range.

## Member Function Documentation

## ◆ drop_front()

template<typename T , typename P = std::pair<T, T>>

void protozero::iterator_range< T, P >::drop_front | ( |  | ) |
| inline

Advance beginning of range by one.

Precondition
  Range must not be empty.

## ◆ empty()

template<typename T , typename P = std::pair<T, T>>

constexpr bool protozero::iterator_range< T, P >::empty | ( |  | ) | const
| inline constexpr noexcept

Return true if this range is empty.

Complexity: Constant.

## ◆ front()

template<typename T , typename P = std::pair<T, T>>

value_type protozero::iterator_range< T, P >::front | ( |  | ) | const
| inline

Get element at the beginning of the range.

Precondition
  Range must not be empty.

## ◆ size()

template<typename T , typename P = std::pair<T, T>>

std::size_t protozero::iterator_range< T, P >::size | ( |  | ) | const
| inline noexcept

Get the size of the range, ie the number of elements it contains.

Complexity: Constant or linear depending on the underlaying iterator.

## ◆ swap()

template<typename T , typename P = std::pair<T, T>>

void protozero::iterator_range< T, P >::swap | ( | iterator_range< T, P > & | other | ) |
| inline noexcept

Swap the contents of this range with the other.

Parameters

  other | Other range to swap data with.

The documentation for this class was generated from the following file:

- include/protozero/iterators.hpp