Namespaces
Variants
Actions

std::move_iterator<Iter>::operator[]

From cppreference.com
 
 
Iterator library
Iterator concepts
Iterator primitives
Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(C++20)
(C++20)
(C++20)
Utilities
(C++20)
Iterator adaptors
Range access
(C++11)(C++14)
(C++14)(C++14)  
(C++11)(C++14)
(C++14)(C++14)  
(C++17)(C++20)
(C++17)
(C++17)
 
 
/* unspecified */ operator[]( difference_type n ) const;
(constexpr since C++17)
(until C++20)
constexpr reference operator[]( difference_type n ) const;
(since C++20)

Returns a reference to the element at specified relative location.

Contents

[edit] Parameters

n - position relative to current location

[edit] Return value

std::move(current [n])(until C++20)ranges::iter_move(current + n)(since C++20)

[edit] Notes

The return type is unspecified because the return type of the underlying iterator's operator[] is also unspecified (see LegacyRandomAccessIterator).

(until C++20)

[edit] Example

#include <cstddef>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <string>
#include <vector>
 
void print(auto rem, const auto& v)
{
    for (std::cout << rem; const auto& e : v)