STD::COUNTED_ITERATOR(3)

✨ NAME ✨

std::counted_iterator< _It > β€” An iterator adaptor that keeps track of the distance to the end.


🌸 SYNOPSIS 🌸

okay so first things first, bestie, you gotta include the header:

#include <iterator>

πŸŽ€ Public Types πŸŽ€

  • using difference_type
  • using iterator_type

πŸ’… Public Member Functions πŸ’…

these are the member functions, and I'm keeping every signature exactly as written because code is not a vibe to mess with:

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 🫢

and these are the friend functions, no cap:

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 line and the class description, exactly as the manpage gives it:

   template<input_or_output_iterator _It>
       class std::counted_iterator< _It >"An iterator adaptor that keeps track
       of the distance to the end.
yes bestie, that quote mark is really in there. I didn't touch it. πŸ™ˆ

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code.

okay so that's the whole page, bestie. this was the std::counted_iterator< _It > page from the Library Functions Manual, and the footer says libstdc++ (Doxygen auto-generated, and there was no date on it, so this is your cute sign-off instead πŸ’…βœ¨). periodt. πŸ¦‹πŸ’–

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms