38 using size_type = int;
39 using difference_type = int;
40 using reference = value_type;
47 using value_type = keywords::value_type;
48 using size_type = keywords::size_type;
49 using difference_type = keywords::difference_type;
50 using reference = keywords::reference;
55 const_iterator()
noexcept =
default;
59 const char * name =
nullptr;
67 {
return *(*
this + idx); }
69 const_iterator & operator++()
70 { ++_idx;
return *
this; }
71 const_iterator operator++(
int)
72 {
return const_iterator(_idx++); }
73 const_iterator & operator+=(
int val)
noexcept
74 { _idx += val;
return *
this; }
75 const_iterator & operator--()
76 { --_idx;
return *
this; }
77 const_iterator operator--(
int)
78 {
return const_iterator(_idx--); }
79 const_iterator & operator-=(
int val)
noexcept
80 { _idx -= val;
return *
this; }
82 friend const_iterator operator+(
const const_iterator & lhs,
int rhs)
noexcept
83 {
return const_iterator(lhs._idx + rhs); }
84 friend const_iterator operator+(
int lhs,
const const_iterator & rhs)
noexcept
85 {
return const_iterator(rhs._idx + lhs); }
87 friend int operator-(
const const_iterator & lhs,
const const_iterator & rhs)
noexcept
88 {
return lhs._idx - rhs._idx; }
89 friend const_iterator operator-(
const const_iterator & lhs,
int rhs)
noexcept
90 {
return const_iterator(lhs._idx - rhs); }
92 friend bool operator==(
const const_iterator & lhs,
const const_iterator & rhs)
noexcept
93 {
return lhs._idx == rhs._idx; }
94 friend bool operator!=(
const const_iterator & lhs,
const const_iterator & rhs)
noexcept
95 {
return lhs._idx != rhs._idx; }
96 friend bool operator<(
const const_iterator & lhs,
const const_iterator & rhs)
noexcept
97 {
return lhs._idx < rhs._idx; }
98 friend bool operator<=(
const const_iterator & lhs,
const const_iterator & rhs)
noexcept
99 {
return lhs._idx <= rhs._idx; }
100 friend bool operator>(
const const_iterator & lhs,
const const_iterator & rhs)
noexcept
101 {
return lhs._idx > rhs._idx; }
102 friend bool operator>=(
const const_iterator & lhs,
const const_iterator & rhs)
noexcept
103 {
return lhs._idx >= rhs._idx; }
106 const_iterator(
int idx) noexcept : _idx(idx)
112 using iterator = const_iterator;
117 int size()
const noexcept
119 bool empty()
const noexcept
120 {
return size() == 0; }
123 {
return *const_iterator(idx); }
125 const_iterator begin()
const noexcept
126 {
return const_iterator(0); }
127 const_iterator cbegin()
const noexcept
128 {
return const_iterator(0); }
129 const_iterator end()
const noexcept
130 {
return const_iterator(size()); }
131 const_iterator cend()
const noexcept
132 {
return const_iterator(size()); }
134 const_reverse_iterator rbegin()
const noexcept
135 {
return const_reverse_iterator(end()); }
136 const_reverse_iterator crbegin()
const noexcept
137 {
return const_reverse_iterator(end()); }
138 const_reverse_iterator rend()
const noexcept
139 {
return const_reverse_iterator(begin()); }
140 const_reverse_iterator crend()
const noexcept
141 {
return const_reverse_iterator(begin()); }