STD::MOVE_ITERATOR(3cxx)
π NAME π
std::move_iterator< _Iterator > β that's the page title, bestie, and the manual-name vibe folded in near the top is std::move_iterator< _Iterator >(3cxx). It's giving iterator-adapter main character energy, no cap.
β¨ SYNOPSIS β¨
okay so first thing, include the iterator header:
#include <iterator>
Inherits std::__detail::__move_iter_cat< _Iterator >.
π Public Types π
these type aliases are the full set β no skips, no edits:
using difference_type = iter_difference_t< _Iterator >
using iterator_concept = decltype(_S_iter_concept())
using iterator_type = _Iterator
using pointer = _Iterator
using reference = iter_rvalue_reference_t< _Iterator >
using value_type = iter_value_t< _Iterator >
π Public Member Functions π
the whole member-function menu, every single signature exactly as the page gives it:
template<typename _Iter >
requires __convertible<_Iter>constexpr move_iterator (const
move_iterator< _Iter > &__i)"
constexpr move_iterator (iterator_type __i)
constexpr iterator_type base () &&
constexpr const iterator_type & base () const &noexcept
constexpr reference operator* () const
constexpr move_iterator operator+ (difference_type __n) const
constexpr move_iterator & operator++ ()
constexpr move_iterator operator++ (int)
constexpr void operator++ (int)
constexpr move_iterator & operator+= (difference_type __n)
constexpr move_iterator operator- (difference_type __n) const
constexpr move_iterator & operator-- ()
constexpr move_iterator operator-- (int)
constexpr move_iterator & operator-= (difference_type __n)
constexpr pointer operator-> () const
template<typename _Iter >
requires __convertible<_Iter> && assignable_from<_Iterator&, const
_Iter&>constexpr move_iterator & operator= (const move_iterator<
_Iter > &__i)"
constexpr reference operator[] (difference_type __n) const
π«Ά Friends π«Ά
friend functions, aka the chosen family of this class:
constexpr iter_rvalue_reference_t< _Iterator > iter_move (const
move_iterator &__i)
noexcept(noexcept(ranges::iter_move(__i._M_current)))
template<indirectly_swappable< _Iterator > _Iter2> constexpr void
iter_swap (const move_iterator &__x, const move_iterator< _Iter2 >
&__y) noexcept(noexcept(ranges::iter_swap(__x._M_current,
__y._M_current)))
template<sized_sentinel_for< _Iterator > _Sent> constexpr
iter_difference_t< _Iterator > operator- (const move_iterator &__x,
const move_sentinel< _Sent > &__y)
template<sized_sentinel_for< _Iterator > _Sent> constexpr
iter_difference_t< _Iterator > operator- (const move_sentinel< _Sent
> &__x, const move_iterator &__y)
template<sentinel_for< _Iterator > _Sent> constexpr bool operator==
(const move_iterator &__x, const move_sentinel< _Sent > &__y)
π§ Detailed Description π§
template<typename _Iterator>
class std::move_iterator< _Iterator >
Class template move_iterator is an iterator adapter with the same behavior as the underlying iterator except that its dereference operator implicitly converts the value returned by the underlying iterator's dereference operator to an rvalue reference. Some generic algorithms can be called with move iterators to replace copying with moving. That's the whole point, bestie: copy less, move more, periodt. π
the move magic is specifically in the dereference operator β iykyk.
πΈ Author πΈ
Generated automatically by Doxygen for libstdc++ from the source code.
Source/version + footer sign-off: source/version is libstdc++, footer line is libstdcstd::move_iterator< _Iterator >(3cxx), and the date is not listed on the page. Bye bestie, go replace copying with moving π
β¨π«Ά
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms