tmp/tmpit9a2g5r/{from.md → to.md}
RENAMED
|
@@ -3,67 +3,73 @@
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template <class Iterator>
|
| 6 |
class move_iterator {
|
| 7 |
public:
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
move_iterator();
|
| 16 |
-
explicit move_iterator(Iterator i);
|
| 17 |
-
template <class U> move_iterator(const move_iterator<U>& u);
|
| 18 |
-
template <class U> move_iterator& operator=(const move_iterator<U>& u);
|
| 19 |
|
| 20 |
-
iterator_type base() const;
|
| 21 |
-
reference operator*() const;
|
| 22 |
-
pointer operator->() const;
|
| 23 |
|
| 24 |
-
move_iterator& operator++();
|
| 25 |
-
move_iterator operator++(int);
|
| 26 |
-
move_iterator& operator--();
|
| 27 |
-
move_iterator operator--(int);
|
| 28 |
|
| 29 |
-
move_iterator operator+(difference_type n) const;
|
| 30 |
-
move_iterator& operator+=(difference_type n);
|
| 31 |
-
move_iterator operator-(difference_type n) const;
|
| 32 |
-
move_iterator& operator-=(difference_type n);
|
| 33 |
-
unspecified operator[](difference_type n) const;
|
| 34 |
|
| 35 |
private:
|
| 36 |
Iterator current; // exposition only
|
| 37 |
};
|
| 38 |
|
| 39 |
template <class Iterator1, class Iterator2>
|
| 40 |
-
bool operator==(
|
| 41 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 42 |
template <class Iterator1, class Iterator2>
|
| 43 |
-
bool operator!=(
|
| 44 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 45 |
template <class Iterator1, class Iterator2>
|
| 46 |
-
bool operator<(
|
| 47 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 48 |
template <class Iterator1, class Iterator2>
|
| 49 |
-
bool operator<=(
|
| 50 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 51 |
template <class Iterator1, class Iterator2>
|
| 52 |
-
bool operator>(
|
| 53 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 54 |
template <class Iterator1, class Iterator2>
|
| 55 |
-
bool operator>=(
|
| 56 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 57 |
|
| 58 |
template <class Iterator1, class Iterator2>
|
| 59 |
-
auto operator-(
|
| 60 |
const move_iterator<Iterator1>& x,
|
| 61 |
const move_iterator<Iterator2>& y) -> decltype(x.base() - y.base());
|
| 62 |
template <class Iterator>
|
| 63 |
-
move_iterator<Iterator> operator+(
|
| 64 |
typename move_iterator<Iterator>::difference_type n, const move_iterator<Iterator>& x);
|
| 65 |
template <class Iterator>
|
| 66 |
-
move_iterator<Iterator> make_move_iterator(Iterator i);
|
| 67 |
}
|
| 68 |
```
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template <class Iterator>
|
| 6 |
class move_iterator {
|
| 7 |
public:
|
| 8 |
+
using iterator_type = Iterator;
|
| 9 |
+
using iterator_category = typename iterator_traits<Iterator>::iterator_category;
|
| 10 |
+
using value_type = typename iterator_traits<Iterator>::value_type;
|
| 11 |
+
using difference_type = typename iterator_traits<Iterator>::difference_type;
|
| 12 |
+
using pointer = Iterator;
|
| 13 |
+
using reference = see below;
|
| 14 |
|
| 15 |
+
constexpr move_iterator();
|
| 16 |
+
constexpr explicit move_iterator(Iterator i);
|
| 17 |
+
template <class U> constexpr move_iterator(const move_iterator<U>& u);
|
| 18 |
+
template <class U> constexpr move_iterator& operator=(const move_iterator<U>& u);
|
| 19 |
|
| 20 |
+
constexpr iterator_type base() const;
|
| 21 |
+
constexpr reference operator*() const;
|
| 22 |
+
constexpr pointer operator->() const;
|
| 23 |
|
| 24 |
+
constexpr move_iterator& operator++();
|
| 25 |
+
constexpr move_iterator operator++(int);
|
| 26 |
+
constexpr move_iterator& operator--();
|
| 27 |
+
constexpr move_iterator operator--(int);
|
| 28 |
|
| 29 |
+
constexpr move_iterator operator+(difference_type n) const;
|
| 30 |
+
constexpr move_iterator& operator+=(difference_type n);
|
| 31 |
+
constexpr move_iterator operator-(difference_type n) const;
|
| 32 |
+
constexpr move_iterator& operator-=(difference_type n);
|
| 33 |
+
constexpr unspecified operator[](difference_type n) const;
|
| 34 |
|
| 35 |
private:
|
| 36 |
Iterator current; // exposition only
|
| 37 |
};
|
| 38 |
|
| 39 |
template <class Iterator1, class Iterator2>
|
| 40 |
+
constexpr bool operator==(
|
| 41 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 42 |
template <class Iterator1, class Iterator2>
|
| 43 |
+
constexpr bool operator!=(
|
| 44 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 45 |
template <class Iterator1, class Iterator2>
|
| 46 |
+
constexpr bool operator<(
|
| 47 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 48 |
template <class Iterator1, class Iterator2>
|
| 49 |
+
constexpr bool operator<=(
|
| 50 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 51 |
template <class Iterator1, class Iterator2>
|
| 52 |
+
constexpr bool operator>(
|
| 53 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 54 |
template <class Iterator1, class Iterator2>
|
| 55 |
+
constexpr bool operator>=(
|
| 56 |
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
|
| 57 |
|
| 58 |
template <class Iterator1, class Iterator2>
|
| 59 |
+
constexpr auto operator-(
|
| 60 |
const move_iterator<Iterator1>& x,
|
| 61 |
const move_iterator<Iterator2>& y) -> decltype(x.base() - y.base());
|
| 62 |
template <class Iterator>
|
| 63 |
+
constexpr move_iterator<Iterator> operator+(
|
| 64 |
typename move_iterator<Iterator>::difference_type n, const move_iterator<Iterator>& x);
|
| 65 |
template <class Iterator>
|
| 66 |
+
constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
|
| 67 |
}
|
| 68 |
```
|
| 69 |
|
| 70 |
+
Let `R` denote `iterator_traits<Iterator>::reference`. If
|
| 71 |
+
`is_reference_v<R>` is `true`, the template specialization
|
| 72 |
+
`move_iterator<Iterator>` shall define the nested type named `reference`
|
| 73 |
+
as a synonym for `remove_reference_t<R>&&`, otherwise as a synonym for
|
| 74 |
+
`R`.
|
| 75 |
+
|