1#ifndef MSTL_CORE_ITERATOR_NORMAL_ITERATOR_HPP__
2#define MSTL_CORE_ITERATOR_NORMAL_ITERATOR_HPP__
27template <
typename Iterator>
45 noexcept(is_nothrow_default_constructible_v<Iterator>) {}
52 noexcept(is_nothrow_copy_constructible_v<Iterator>)
60 template <
typename Iter, enable_if_t<is_convertible_v<Iter, Iterator>,
int> = 0>
62 noexcept(is_nothrow_copy_constructible_v<Iterator>)
63 : current_(other.
base()) {}
82 noexcept(noexcept(++current_)) {
92 noexcept(
noexcept(current_++)) {
101 noexcept(noexcept(--current_)) {
111 noexcept(
noexcept(current_--)) {
130 noexcept(
noexcept(current_ += n)) {
141 noexcept(
noexcept(current_ + n)) {
151 noexcept(
noexcept(current_ -= n)) {
162 noexcept(
noexcept(current_ - n)) {
170 constexpr const Iterator&
base() const noexcept {
180template <
typename LeftIter,
typename RightIter>
184 return lhs.base() == rhs.base();
191template <
typename Iterator>
195 return lhs.base() == rhs.base();
203template <
typename LeftIter,
typename RightIter>
207 return lhs.base() != rhs.base();
214template <
typename Iterator>
218 return lhs.base() != rhs.base();
226template <
typename LeftIter,
typename RightIter>
230 return lhs.base() < rhs.base();
237template <
typename Iterator>
241 return lhs.base() < rhs.base();
249template <
typename LeftIter,
typename RightIter>
253 return lhs.base() > rhs.base();
260template <
typename Iterator>
264 return lhs.base() > rhs.base();
272template <
typename LeftIter,
typename RightIter>
276 return lhs.base() <= rhs.base();
283template <
typename Iterator>
287 return lhs.base() <= rhs.base();
295template <
typename LeftIter,
typename RightIter>
299 return lhs.base() >= rhs.base();
306template <
typename Iterator>
310 return lhs.base() >= rhs.base();
319template <
typename LeftIter,
typename RightIter>
323 ->
decltype(lhs.base() - rhs.base()) {
324 return lhs.base() - rhs.base();
332template <
typename Iterator>
336 return lhs.base() - rhs.base();
346template <
typename Iterator>
constexpr normal_iterator & operator++() noexcept(noexcept(++current_))
前置自增操作符
constexpr normal_iterator(const normal_iterator< Iter > &other) noexcept(is_nothrow_copy_constructible_v< Iterator >)
从其他normal_iterator转换构造
constexpr normal_iterator operator+(difference_type n) const noexcept(noexcept(current_+n))
加法操作符
iter_difference_t< Iterator > difference_type
差值类型
iter_value_t< Iterator > value_type
元素值类型
constexpr const pointer & base() const noexcept
constexpr pointer operator->() const noexcept
成员访问操作符
constexpr reference operator[](difference_type n) const noexcept
下标访问操作符
constexpr normal_iterator() noexcept(is_nothrow_default_constructible_v< Iterator >)
默认构造函数
constexpr normal_iterator & operator--() noexcept(noexcept(--current_))
前置自减操作符
constexpr normal_iterator operator-(difference_type n) const noexcept(noexcept(current_ - n))
减法操作符
constexpr normal_iterator & operator-=(difference_type n) noexcept(noexcept(current_ -=n))
减法赋值操作符
constexpr normal_iterator(const Iterator &iter) noexcept(is_nothrow_copy_constructible_v< Iterator >)
从底层迭代器构造
iter_category_t< Iterator > iterator_category
迭代器类别
constexpr reference operator*() const noexcept
解引用操作符
Iterator iterator_type
底层迭代器类型
iter_reference_t< Iterator > reference
引用类型
constexpr normal_iterator & operator+=(difference_type n) noexcept(noexcept(current_+=n))
加法赋值操作符
iter_pointer_t< Iterator > pointer
指针类型
typename iterator_traits< Iterator >::reference iter_reference_t
获取迭代器的引用类型
typename iterator_traits< Iterator >::iterator_category iter_category_t
获取迭代器的类别标签
typename iterator_traits< Iterator >::value_type iter_value_t
获取迭代器的值类型
typename iterator_traits< Iterator >::difference_type iter_difference_t
获取迭代器的差值类型
typename iterator_traits< Iterator >::pointer iter_pointer_t
获取迭代器的指针类型
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
MSTL_NODISCARD constexpr normal_iterator< Iterator > operator+(iter_difference_t< normal_iterator< Iterator > > n, const normal_iterator< Iterator > &iter) noexcept
加法运算符
MSTL_NODISCARD constexpr bool operator!=(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
不等比较运算符
MSTL_NODISCARD constexpr bool operator==(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
相等比较运算符
MSTL_NODISCARD constexpr bool operator<=(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
小于等于比较运算符
MSTL_NODISCARD constexpr bool operator>=(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
大于等于比较运算符
MSTL_NODISCARD constexpr bool operator>(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
大于比较运算符
MSTL_NODISCARD constexpr auto operator-(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept -> decltype(lhs.base() - rhs.base())
减法运算符
MSTL_NODISCARD constexpr bool operator<(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
小于比较运算符