1#ifndef NEFORCE_CORE_ITERATOR_NORMAL_ITERATOR_HPP__
2#define NEFORCE_CORE_ITERATOR_NORMAL_ITERATOR_HPP__
12NEFORCE_BEGIN_NAMESPACE__
27template <
typename Iterator>
58 template <
typename Iter, enable_if_t<is_convertible_v<Iter, Iterator>,
int> = 0>
60 current_(other.
base()) {}
153 constexpr const Iterator&
base() const noexcept {
return current_; }
161template <
typename LeftIter,
typename RightIter>
164 return lhs.base() == rhs.base();
171template <
typename Iterator>
174 return lhs.base() == rhs.base();
182template <
typename LeftIter,
typename RightIter>
185 return lhs.base() != rhs.base();
192template <
typename Iterator>
195 return lhs.base() != rhs.base();
203template <
typename LeftIter,
typename RightIter>
206 return lhs.base() < rhs.base();
213template <
typename Iterator>
216 return lhs.base() < rhs.base();
224template <
typename LeftIter,
typename RightIter>
227 return lhs.base() > rhs.base();
234template <
typename Iterator>
237 return lhs.base() > rhs.base();
245template <
typename LeftIter,
typename RightIter>
248 return lhs.base() <= rhs.base();
255template <
typename Iterator>
258 return lhs.base() <= rhs.base();
266template <
typename LeftIter,
typename RightIter>
269 return lhs.base() >= rhs.base();
276template <
typename Iterator>
279 return lhs.base() >= rhs.base();
288template <
typename LeftIter,
typename RightIter>
291 ->
decltype(lhs.base() - rhs.base()) {
292 return lhs.base() - rhs.base();
300template <
typename Iterator>
303 return lhs.base() - rhs.base();
313template <
typename Iterator>
321NEFORCE_END_NAMESPACE__
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 normal_iterator operator++(int) noexcept(noexcept(current_++))
后置自增操作符
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
指针类型
constexpr normal_iterator operator--(int) noexcept(noexcept(current_--))
后置自减操作符
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
获取迭代器的指针类型
NEFORCE_NODISCARD constexpr bool operator<=(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
小于等于比较运算符
NEFORCE_NODISCARD constexpr bool operator<(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
小于比较运算符
NEFORCE_NODISCARD constexpr bool operator>(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
大于比较运算符
NEFORCE_NODISCARD constexpr bool operator!=(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
不等比较运算符
NEFORCE_NODISCARD constexpr auto operator-(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept -> decltype(lhs.base() - rhs.base())
减法运算符
NEFORCE_NODISCARD constexpr bool operator==(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
相等比较运算符
NEFORCE_NODISCARD constexpr normal_iterator< Iterator > operator+(iter_difference_t< normal_iterator< Iterator > > n, const normal_iterator< Iterator > &iter) noexcept
加法运算符
NEFORCE_NODISCARD constexpr bool operator>=(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
大于等于比较运算符
NEFORCE_INLINE17 constexpr bool is_nothrow_default_constructible_v
is_nothrow_default_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_copy_constructible_v
is_nothrow_copy_constructible的便捷变量模板