Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
std::move_iterator< Iterator > Class Template Reference

An iterator adaptor that wraps another iterator such that dereferencing the wrapped iterator yields an rvalue reference to the source value. More...

Public Types

using difference_type = typename iterator_traits<Iterator>::difference_type
 The difference type of the iterator.
 
using iterator_category = typename iterator_traits<Iterator>::iterator_category
 iterator category tag type
 
using iterator_type = Iterator
 The type of the underlying iterator.
 
using pointer = Iterator
 iterator pointer type
 
using reference
 iterator reference type
 
using value_type = typename iterator_traits<Iterator>::value_type
 iterator value type
 

Public Member Functions

template<typename SfinaeIterator = Iterator, arene::base::constraints< enable_if_t< is_default_constructible_v< SfinaeIterator > > > = nullptr>
 move_iterator () noexcept(is_nothrow_default_constructible_v< Iterator >)
 Default construct the iterator, holding a default-constructed underlying iterator. Only available if Iterator is default-constructible.
 
 move_iterator (Iterator iter) noexcept(is_nothrow_copy_constructible_v< Iterator >)
 Construct an iterator holding the specified value of the underlying iterator.
 
 move_iterator (move_iterator &&)=default
 Default move constructor.
 
 move_iterator (move_iterator const &)=default
 Default copy constructor.
 
template<typename OtherIterator, arene::base::constraints< enable_if_t< is_convertible_v< OtherIterator, Iterator > > > = nullptr>
 move_iterator (move_iterator< OtherIterator > const &source)
 Conversion constructor from another move iterator with a different type of underlying iterator. The stored iterator is constructed from the underlying iterator of the source move iterator. Requires that the source underlying iterator is convertible to Iterator.
 
 ~move_iterator ()=default
 Default destructor.
 
auto base () const -> iterator_type
 Retrieve the underlying iterator.
 
auto operator* () const -> reference
 Dereference the iterator.
 
auto operator+ (difference_type delta) const -> move_iterator
 Obtain a new iterator referencing the value from moving the current iterator forwards by a specified amount.
 
auto operator++ () -> move_iterator &
 Preincrement operator. Increments the stored iterator.
 
auto operator++ (int) -> move_iterator
 Postincrement operator. Increments the stored iterator.
 
auto operator+= (difference_type delta) -> move_iterator &
 Move the current iterator forwards by a specified amount.
 
auto operator- (difference_type delta) const -> move_iterator
 Obtain a new iterator referencing the value from moving the current iterator backwards by a specified amount.
 
auto operator-- () -> move_iterator &
 Predecrement operator. Decrements the stored iterator.
 
auto operator-- (int) -> move_iterator
 Postdecrement operator. Decrements the stored iterator.
 
auto operator-= (difference_type delta) -> move_iterator &
 Move the current iterator backwards by a specified amount.
 
auto operator-> () const -> pointer
 Arrow dereference operator for accessing the referenced value.
 
auto operator= (move_iterator &&) -> move_iterator &=default
 Default move assignment operator.
 
auto operator= (move_iterator const &) -> move_iterator &=default
 Default copy assignment operator.
 
template<typename OtherIterator, arene::base::constraints< enable_if_t< is_convertible_v< OtherIterator, Iterator > > > = nullptr>
auto operator= (move_iterator< OtherIterator > const &source) -> move_iterator &
 Conversion assignment from another move iterator with a different type of underlying iterator. The stored iterator is assigned from the underlying iterator of the source move iterator. Requires that the source underlying iterator can be assigned to Iterator.
 
auto operator[] (difference_type delta) const -> reference
 Access the value at a specified offset from the current iterator.
 

Detailed Description

template<typename Iterator>
class std::move_iterator< Iterator >

An iterator adaptor that wraps another iterator such that dereferencing the wrapped iterator yields an rvalue reference to the source value.

Template Parameters
Iteratorthe type of the underlying iterator

Member Typedef Documentation

◆ difference_type

template<typename Iterator>
using std::move_iterator< Iterator >::difference_type = typename iterator_traits<Iterator>::difference_type

The difference type of the iterator.

◆ iterator_category

template<typename Iterator>
using std::move_iterator< Iterator >::iterator_category = typename iterator_traits<Iterator>::iterator_category

iterator category tag type

◆ iterator_type

template<typename Iterator>
using std::move_iterator< Iterator >::iterator_type = Iterator

The type of the underlying iterator.

◆ pointer

template<typename Iterator>
using std::move_iterator< Iterator >::pointer = Iterator

iterator pointer type

◆ reference

template<typename Iterator>
using std::move_iterator< Iterator >::reference
Initial value:
provides a uniform interface to the properties of an iterator
Definition iterator_traits.hpp:90
typename conditional< Condition, TrueType, FalseType >::type conditional_t
Helper template alias for selecting types based on a condition. If the supplied Condition is true the...
Definition conditional.hpp:57
constexpr bool is_reference_v
Check if the supplied template argument is a reference or not. The value is true if so,...
typename remove_reference< T >::type remove_reference_t
An alias for T, but with top-level reference qualifiers removed.
Definition remove_reference.hpp:47

iterator reference type

◆ value_type

template<typename Iterator>
using std::move_iterator< Iterator >::value_type = typename iterator_traits<Iterator>::value_type

iterator value type

Constructor & Destructor Documentation

◆ move_iterator() [1/5]

template<typename Iterator>
template<typename SfinaeIterator = Iterator, arene::base::constraints< enable_if_t< is_default_constructible_v< SfinaeIterator > > > = nullptr>
std::move_iterator< Iterator >::move_iterator ( )
inlinenoexcept

Default construct the iterator, holding a default-constructed underlying iterator. Only available if Iterator is default-constructible.

Template Parameters
SfinaeIteratorDummy type to ensure underlying iterator is default-constructible

◆ move_iterator() [2/5]

template<typename Iterator>
std::move_iterator< Iterator >::move_iterator ( Iterator iter)
inlineexplicitnoexcept

Construct an iterator holding the specified value of the underlying iterator.

Parameters
iterThe iterator to store

◆ move_iterator() [3/5]

template<typename Iterator>
std::move_iterator< Iterator >::move_iterator ( move_iterator< Iterator > const & )
default

Default copy constructor.

◆ move_iterator() [4/5]

template<typename Iterator>
std::move_iterator< Iterator >::move_iterator ( move_iterator< Iterator > && )
default

Default move constructor.

◆ ~move_iterator()

template<typename Iterator>
std::move_iterator< Iterator >::~move_iterator ( )
default

Default destructor.

◆ move_iterator() [5/5]

template<typename Iterator>
template<typename OtherIterator, arene::base::constraints< enable_if_t< is_convertible_v< OtherIterator, Iterator > > > = nullptr>
std::move_iterator< Iterator >::move_iterator ( move_iterator< OtherIterator > const & source)
inline

Conversion constructor from another move iterator with a different type of underlying iterator. The stored iterator is constructed from the underlying iterator of the source move iterator. Requires that the source underlying iterator is convertible to Iterator.

Template Parameters
OtherIteratorThe type of the underlying iterator of the source iterator
Parameters
sourceThe source iterator

Member Function Documentation

◆ base()

template<typename Iterator>
auto std::move_iterator< Iterator >::base ( ) const -> iterator_type
inline

Retrieve the underlying iterator.

Returns
A copy of the stored underlying iterator

◆ operator*()

template<typename Iterator>
auto std::move_iterator< Iterator >::operator* ( ) const -> reference
inline

Dereference the iterator.

Returns
An rvalue reference to the referred to value, if the underlying iterator returns a reference, or a copy of the referenced value otherwise

◆ operator+()

template<typename Iterator>
auto std::move_iterator< Iterator >::operator+ ( difference_type delta) const -> move_iterator
inline

Obtain a new iterator referencing the value from moving the current iterator forwards by a specified amount.

Parameters
deltaThe amount to move
Returns
A new iterator referencing the new value
Precondition
Iterator must be a random access iterator

◆ operator++() [1/2]

template<typename Iterator>
auto std::move_iterator< Iterator >::operator++ ( ) -> move_iterator&
inline

Preincrement operator. Increments the stored iterator.

Returns
A reference to *this

◆ operator++() [2/2]

template<typename Iterator>
auto std::move_iterator< Iterator >::operator++ ( int ) -> move_iterator
inline

Postincrement operator. Increments the stored iterator.

Returns
A copy of *this prior to the increment

◆ operator+=()

template<typename Iterator>
auto std::move_iterator< Iterator >::operator+= ( difference_type delta) -> move_iterator&
inline

Move the current iterator forwards by a specified amount.

Parameters
deltaThe amount to move
Returns
A reference to *this
Precondition
Iterator must be a random access iterator

◆ operator-()

template<typename Iterator>
auto std::move_iterator< Iterator >::operator- ( difference_type delta) const -> move_iterator
inline

Obtain a new iterator referencing the value from moving the current iterator backwards by a specified amount.

Parameters
deltaThe amount to move
Returns
A new iterator referencing the new value
Precondition
Iterator must be a random access iterator

◆ operator--() [1/2]

template<typename Iterator>
auto std::move_iterator< Iterator >::operator-- ( ) -> move_iterator&
inline

Predecrement operator. Decrements the stored iterator.

Returns
A reference to *this
Precondition
Iterator must be at least a bidirectional iterator

◆ operator--() [2/2]

template<typename Iterator>
auto std::move_iterator< Iterator >::operator-- ( int ) -> move_iterator
inline

Postdecrement operator. Decrements the stored iterator.

Returns
A copy of *this prior to the decrement
Precondition
Iterator must be at least a bidirectional iterator

◆ operator-=()

template<typename Iterator>
auto std::move_iterator< Iterator >::operator-= ( difference_type delta) -> move_iterator&
inline

Move the current iterator backwards by a specified amount.

Parameters
deltaThe amount to move
Returns
A reference to *this
Precondition
Iterator must be a random access iterator

◆ operator->()

template<typename Iterator>
auto std::move_iterator< Iterator >::operator-> ( ) const -> pointer
inline

Arrow dereference operator for accessing the referenced value.

Returns
A copy of the stored underlying iterator

◆ operator=() [1/3]

template<typename Iterator>
auto std::move_iterator< Iterator >::operator= ( move_iterator< Iterator > && ) -> move_iterator &=default
default

Default move assignment operator.

◆ operator=() [2/3]

template<typename Iterator>
auto std::move_iterator< Iterator >::operator= ( move_iterator< Iterator > const & ) -> move_iterator &=default
default

Default copy assignment operator.

◆ operator=() [3/3]

template<typename Iterator>
template<typename OtherIterator, arene::base::constraints< enable_if_t< is_convertible_v< OtherIterator, Iterator > > > = nullptr>
auto std::move_iterator< Iterator >::operator= ( move_iterator< OtherIterator > const & source) -> move_iterator&
inline

Conversion assignment from another move iterator with a different type of underlying iterator. The stored iterator is assigned from the underlying iterator of the source move iterator. Requires that the source underlying iterator can be assigned to Iterator.

Template Parameters
OtherIteratorThe type of the underlying iterator of the source iterator
Parameters
sourceThe source iterator
Returns
A reference to *this

◆ operator[]()

template<typename Iterator>
auto std::move_iterator< Iterator >::operator[] ( difference_type delta) const -> reference
inline

Access the value at a specified offset from the current iterator.

Parameters
deltaThe offset to the new position
Returns
An rvalue reference to the specified value
Precondition
Iterator must be a random access iterator

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