Loading...
Searching...
No Matches
bsoncxx::v1::document::view::const_iterator Class Reference

`#include <bsoncxx/v1/document/view.hpp>`

## Description

A const iterator over the elements of a view.

Note
  This iterator almost satisfies Cpp17ForwardIterator, but std::iterator_traits<T>::reference is defined as value_type, similar to std::vector<bool>::iterator and std::istreambuf_iterator<T>. Therefore, this iterator only fully satisfies Cpp17InputIterator.

## Public Types

using | difference_type = std::ptrdiff_t
| Provide std::iterator_traits<T>::difference_type.
using | iterator_category = std::input_iterator_tag
| Provide std::iterator_traits<T>::iterator_category.
using | pointer = value_type const*
| Provide std::iterator_traits<T>::pointer.
using | reference = value_type
| Provide std::iterator_traits<T>::reference.
using | value_type = v1::element::view
| Provide std::iterator_traits<T>::value_type.

## Public Member Functions

| const_iterator ()=default
| Initialize as an end iterator.
reference | operator* () const
| Return the current element.
const_iterator & | operator++ ()
| Pre-increment this iterator.
const_iterator | operator++ (int)
| Post-increment this iterator.
pointer | operator-> () const
| Access the current element.

## Friends

bool | operator!= (const_iterator const &lhs, const_iterator const &rhs)
| Equivalent to !(lhs == rhs).
bool | operator== (const_iterator const &lhs, const_iterator const &rhs)
| Compare equal when lhs and rhs point to the same element within the same range of BSON bytes.

## Member Typedef Documentation

## difference_type

using bsoncxx::v1::document::view::const_iterator::difference_type = std::ptrdiff_t

Provide std::iterator_traits<T>::difference_type.

## iterator_category

using bsoncxx::v1::document::view::const_iterator::iterator_category = std::input_iterator_tag

Provide std::iterator_traits<T>::iterator_category.

## pointer

using bsoncxx::v1::document::view::const_iterator::pointer = value_type const*

Provide std::iterator_traits<T>::pointer.

## reference

using bsoncxx::v1::document::view::const_iterator::reference = value_type

Provide std::iterator_traits<T>::reference.

## value_type

using bsoncxx::v1::document::view::const_iterator::value_type = v1::element::view

Provide std::iterator_traits<T>::value_type.

## Constructor & Destructor Documentation

## const_iterator()

bsoncxx::v1::document::view::const_iterator::const_iterator | ( |  | ) |

default

Initialize as an end iterator.

## Member Function Documentation

## operator*()

reference bsoncxx::v1::document::view::const_iterator::operator* | ( |  | ) | const

inline

Return the current element.

If this is an end iterator, returns an invalid element.

## operator++() [1/2]

const_iterator & bsoncxx::v1::document::view::const_iterator::operator++ | ( |  | ) |

Pre-increment this iterator.

If this is an end iterator, it remains an end iterator.

## operator++() [2/2]

const_iterator bsoncxx::v1::document::view::const_iterator::operator++ | ( | int |  | ) |

inline

Post-increment this iterator.

If this is an end iterator, it remains an end iterator.

## operator->()

pointer bsoncxx::v1::document::view::const_iterator::operator-> | ( |  | ) | const

inline

Access the current element.

If this is an end iterator, accesses an invalid element.

## Friends And Related Symbol Documentation

## operator!=

bool operator!= | ( | const_iterator const & | lhs,
|  | const_iterator const & | rhs )

friend

Equivalent to !(lhs == rhs).

## operator==

bool operator== | ( | const_iterator const & | lhs,
|  | const_iterator const & | rhs )

friend

Compare equal when lhs and rhs point to the same element within the same range of BSON bytes.

An end iterator only compares equal to another end iterator. The underlying BSON bytes (if any) is ignored for an end iterator.

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

- bsoncxx/v1/document/view.hpp