libstdc++: std::counted_iterator< _It > Class Template Reference

libstdc++

std::counted_iterator< _It > Class Template Reference
Iterators

`#include <stl_iterator.h>`

## Public Types
using | difference_type
using | iterator_type

## Public Member Functions
constexpr | counted_iterator (_It __i, iter_difference_t< _It > __n)
template<typename _It2>
constexpr | counted_iterator (const counted_iterator< _It2 > &__x)
constexpr _It | base () &&noexcept(is_nothrow_move_constructible_v< _It >)
constexpr const _It & | base () const &noexcept
constexpr iter_difference_t< _It > | count () const noexcept
constexpr decltype(auto) | operator* () const noexcept(noexcept(*_M_current))
constexpr decltype(auto) | operator* () noexcept(noexcept(*_M_current))
constexpr counted_iterator | operator+ (iter_difference_t< _It > __n) const
constexpr counted_iterator & | operator++ ()
constexpr counted_iterator | operator++ (int)
constexpr decltype(auto) | operator++ (int)
constexpr counted_iterator & | operator+= (iter_difference_t< _It > __n)
constexpr counted_iterator | operator- (iter_difference_t< _It > __n) const
constexpr counted_iterator & | operator-- ()
constexpr counted_iterator | operator-- (int)
constexpr counted_iterator & | operator-= (iter_difference_t< _It > __n)
constexpr auto | operator-> () const noexcept
template<typename _It2>
constexpr counted_iterator & | operator= (const counted_iterator< _It2 > &__x)
constexpr decltype(auto) | operator[] (iter_difference_t< _It > __n) const noexcept(noexcept(_M_current[__n]))

## Friends
constexpr iter_rvalue_reference_t< _It > | iter_move (const counted_iterator &__i) noexcept(noexcept(ranges::iter_move(__i._M_current)))
template<indirectly_swappable< _It > _It2>
constexpr void | iter_swap (const counted_iterator &__x, const counted_iterator< _It2 > &__y) noexcept(noexcept(ranges::iter_swap(__x._M_current, __y._M_current)))
constexpr counted_iterator | operator+ (iter_difference_t< _It > __n, const counted_iterator &__x)
template<common_with< _It > _It2>
constexpr iter_difference_t< _It2 > | operator- (const counted_iterator &__x, const counted_iterator< _It2 > &__y) noexcept
constexpr iter_difference_t< _It > | operator- (const counted_iterator &__x, default_sentinel_t) noexcept
constexpr iter_difference_t< _It > | operator- (default_sentinel_t, const counted_iterator &__y) noexcept
template<common_with< _It > _It2>
constexpr strong_ordering | operator<=> (const counted_iterator &__x, const counted_iterator< _It2 > &__y) noexcept
template<common_with< _It > _It2>
constexpr bool | operator== (const counted_iterator &__x, const counted_iterator< _It2 > &__y) noexcept
constexpr bool | operator== (const counted_iterator &__x, default_sentinel_t) noexcept

## Detailed Description

template<input_or_output_iterator _It>
class std::counted_iterator< _It >

An iterator adaptor that keeps track of the distance to the end.

Definition at line 2374 of file bits/stl_iterator.h.

## Member Typedef Documentation

## ◆ difference_type

template<input_or_output_iterator _It>

using std::counted_iterator< _It >::difference_type

Definition at line 2382 of file bits/stl_iterator.h.

## ◆ iterator_type

template<input_or_output_iterator _It>

using std::counted_iterator< _It >::iterator_type

Definition at line 2380 of file bits/stl_iterator.h.

## Constructor & Destructor Documentation

## ◆ counted_iterator() [1/2]

template<input_or_output_iterator _It>

std::counted_iterator< _It >::counted_iterator | ( | _It | __i,
|  | iter_difference_t< _It > | __n )
| inlineconstexpr

Definition at line 2389 of file bits/stl_iterator.h.

## ◆ counted_iterator() [2/2]

template<input_or_output_iterator _It>
template<typename _It2>

std::counted_iterator< _It >::counted_iterator | ( | const counted_iterator< _It2 > & | __x | ) |
| inlineconstexpr

Definition at line 2396 of file bits/stl_iterator.h.

## Member Function Documentation

## ◆ base() [1/2]

template<input_or_output_iterator _It>

_It std::counted_iterator< _It >::base | ( |  | ) | &&
| inlinenodiscardconstexprnoexcept

Definition at line 2417 of file bits/stl_iterator.h.

## ◆ base() [2/2]

template<input_or_output_iterator _It>

const _It & std::counted_iterator< _It >::base | ( |  | ) | const &
| inlinenodiscardconstexprnoexcept

Definition at line 2412 of file bits/stl_iterator.h.

## ◆ count()

template<input_or_output_iterator _It>

iter_difference_t< _It > std::counted_iterator< _It >::count | ( |  | ) | const
| inlinenodiscardconstexprnoexcept

Definition at line 2423 of file bits/stl_iterator.h.

## ◆ operator*() [1/2]

template<input_or_output_iterator _It>

decltype(auto) std::counted_iterator< _It >::operator* | ( |  | ) | const
| inlinenodiscardconstexprnoexcept

Definition at line 2436 of file bits/stl_iterator.h.

## ◆ operator*() [2/2]

template<input_or_output_iterator _It>

decltype(auto) std::counted_iterator< _It >::operator* | ( |  | ) |
| inlinenodiscardconstexprnoexcept

Definition at line 2427 of file bits/stl_iterator.h.

## ◆ operator+()

template<input_or_output_iterator _It>

counted_iterator std::counted_iterator< _It >::operator+ | ( | iter_difference_t< _It > | __n | ) | const
| inlinenodiscardconstexpr

Definition at line 2501 of file bits/stl_iterator.h.

## ◆ operator++() [1/3]

template<input_or_output_iterator _It>

counted_iterator & std::counted_iterator< _It >::operator++ | ( |  | ) |
| inlineconstexpr

Definition at line 2451 of file bits/stl_iterator.h.

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

template<input_or_output_iterator _It>

counted_iterator std::counted_iterator< _It >::operator++ | ( | int |  | ) |
| inlineconstexpr

Definition at line 2476 of file bits/stl_iterator.h.

## ◆ operator++() [3/3]

template<input_or_output_iterator _It>

decltype(auto) std::counted_iterator< _It >::operator++ | ( | int |  | ) |
| inlineconstexpr

Definition at line 2462 of file bits/stl_iterator.h.

## ◆ operator+=()

template<input_or_output_iterator _It>

counted_iterator & std::counted_iterator< _It >::operator+= | ( | iter_difference_t< _It > | __n | ) |
| inlineconstexpr

Definition at line 2512 of file bits/stl_iterator.h.

## ◆ operator-()

template<input_or_output_iterator _It>

counted_iterator std::counted_iterator< _It >::operator- | ( | iter_difference_t< _It > | __n | ) | const
| inlinenodiscardconstexpr

Definition at line 2523 of file bits/stl_iterator.h.

## ◆ operator--() [1/2]

template<input_or_output_iterator _It>

counted_iterator & std::counted_iterator< _It >::operator-- | ( |  | ) |
| inlineconstexpr

Definition at line 2484 of file bits/stl_iterator.h.

## ◆ operator--() [2/2]

template<input_or_output_iterator _It>

counted_iterator std::counted_iterator< _It >::operator-- | ( | int |  | ) |
| inlineconstexpr

Definition at line 2492 of file bits/stl_iterator.h.

## ◆ operator-=()

template<input_or_output_iterator _It>

counted_iterator & std::counted_iterator< _It >::operator-= | ( | iter_difference_t< _It > | __n | ) |
| inlineconstexpr

Definition at line 2545 of file bits/stl_iterator.h.

## ◆ operator->()

template<input_or_output_iterator _It>

auto std::counted_iterator< _It >::operator-> | ( |  | ) | const
| inlinenodiscardconstexprnoexcept

Definition at line 2446 of file bits/stl_iterator.h.

## ◆ operator=()

template<input_or_output_iterator _It>
template<typename _It2>

counted_iterator & std::counted_iterator< _It >::operator= | ( | const counted_iterator< _It2 > & | __x | ) |
| inlineconstexpr

Definition at line 2403 of file bits/stl_iterator.h.

## ◆ operator[]()

template<input_or_output_iterator _It>

decltype(auto) std::counted_iterator< _It >::operator[] | ( | iter_difference_t< _It > | __n | ) | const
| inlinenodiscardconstexprnoexcept

Definition at line 2556 of file bits/stl_iterator.h.

## Friends And Related Symbol Documentation

## ◆ counted_iterator

template<input_or_output_iterator _It>
template<input_or_output_iterator _It2>

friend class counted_iterator
| friend

Definition at line 2604 of file bits/stl_iterator.h.

## ◆ iter_move

template<input_or_output_iterator _It>

iter_rvalue_reference_t< _It > iter_move | ( | const counted_iterator< _It > & | __i | ) |
| friend

Definition at line 2585 of file bits/stl_iterator.h.

## ◆ iter_swap

template<input_or_output_iterator _It>
template<indirectly_swappable< _It > _It2>

void iter_swap | ( | const counted_iterator< _It > & | __x,
|  | const counted_iterator< _It2 > & | __y )
| friend

Definition at line 2595 of file bits/stl_iterator.h.

## ◆ operator+

template<input_or_output_iterator _It>

counted_iterator operator+ | ( | iter_difference_t< _It > | __n,
|  | const counted_iterator< _It > & | __x )
| friend

Definition at line 2507 of file bits/stl_iterator.h.

## ◆ operator- [1/3]

template<input_or_output_iterator _It>
template<common_with< _It > _It2>

iter_difference_t< _It2 > operator- | ( | const counted_iterator< _It > & | __x,
|  | const counted_iterator< _It2 > & | __y )
| friend

Definition at line 2530 of file bits/stl_iterator.h.

## ◆ operator- [2/3]

template<input_or_output_iterator _It>

iter_difference_t< _It > operator- | ( | const counted_iterator< _It > & | __x,
|  | default_sentinel_t | )
| friend

Definition at line 2536 of file bits/stl_iterator.h.

## ◆ operator- [3/3]

template<input_or_output_iterator _It>

iter_difference_t< _It > operator- | ( | default_sentinel_t | ,
|  | const counted_iterator< _It > & | __y )
| friend

Definition at line 2541 of file bits/stl_iterator.h.

## ◆ operator<=>

template<input_or_output_iterator _It>
template<common_with< _It > _It2>

strong_ordering operator<=> | ( | const counted_iterator< _It > & | __x,
|  | const counted_iterator< _It2 > & | __y )
| friend

Definition at line 2578 of file bits/stl_iterator.h.

## ◆ operator== [1/2]

template<input_or_output_iterator _It>
template<common_with< _It > _It2>

bool operator== | ( | const counted_iterator< _It > & | __x,
|  | const counted_iterator< _It2 > & | __y )
| friend

Definition at line 2567 of file bits/stl_iterator.h.

## ◆ operator== [2/2]

template<input_or_output_iterator _It>

bool operator== | ( | const counted_iterator< _It > & | __x,
|  | default_sentinel_t | )
| friend

Definition at line 2573 of file bits/stl_iterator.h.

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

- bits/stl_iterator.h