|
|
@@ -25,8 +25,8 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- template <typename D> requires (difference_type_arg<D, self_type> &&
|
|
|
- random_access<self_type>)
|
|
|
+ template <typename D>
|
|
|
+ requires(difference_type_arg<D, self_type> && random_access<self_type>)
|
|
|
decltype(auto) operator[](D off) const {
|
|
|
return *(self() + off);
|
|
|
}
|
|
|
@@ -35,7 +35,8 @@ public:
|
|
|
if constexpr (forward<self_type>) {
|
|
|
self().increment();
|
|
|
} else {
|
|
|
- static_assert(random_access<self_type>, "requires .increment() or .advance()");
|
|
|
+ static_assert(random_access<self_type>,
|
|
|
+ "requires .increment() or .advance()");
|
|
|
self() += 1;
|
|
|
}
|
|
|
return self();
|
|
|
@@ -55,7 +56,8 @@ public:
|
|
|
if constexpr (bidirectional<self_type>) {
|
|
|
self().decrement();
|
|
|
} else {
|
|
|
- static_assert(random_access<self_type>, "requires .decrement() or .advance()");
|
|
|
+ static_assert(random_access<self_type>,
|
|
|
+ "requires .decrement() or .advance()");
|
|
|
self() -= 1;
|
|
|
}
|
|
|
return self();
|
|
|
@@ -67,39 +69,41 @@ public:
|
|
|
return tmp;
|
|
|
}
|
|
|
|
|
|
- template <typename D> requires (difference_type_arg<D, self_type> &&
|
|
|
- random_access<self_type>)
|
|
|
+ template <typename D>
|
|
|
+ requires(difference_type_arg<D, self_type> && random_access<self_type>)
|
|
|
friend self_type & operator+=(self_type & self, D off) {
|
|
|
self.advance(off);
|
|
|
return self;
|
|
|
}
|
|
|
|
|
|
- template <typename D> requires (difference_type_arg<D, self_type> &&
|
|
|
- random_access<self_type>)
|
|
|
+ template <typename D>
|
|
|
+ requires(difference_type_arg<D, self_type> && random_access<self_type>)
|
|
|
friend self_type & operator-=(self_type & self, D off) {
|
|
|
self.advance(-off);
|
|
|
return self;
|
|
|
}
|
|
|
|
|
|
- template <typename D> requires (difference_type_arg<D, self_type> &&
|
|
|
- random_access<self_type>)
|
|
|
+ template <typename D>
|
|
|
+ requires(difference_type_arg<D, self_type> && random_access<self_type>)
|
|
|
friend auto operator+(self_type self, D off) {
|
|
|
return self += off;
|
|
|
}
|
|
|
|
|
|
- template <typename D> requires (difference_type_arg<D, self_type> &&
|
|
|
- random_access<self_type>)
|
|
|
+ template <typename D>
|
|
|
+ requires(difference_type_arg<D, self_type> && random_access<self_type>)
|
|
|
friend auto operator+(D off, self_type self) {
|
|
|
return self += off;
|
|
|
}
|
|
|
|
|
|
- template <typename D> requires (difference_type_arg<D, self_type> &&
|
|
|
- random_access<self_type>)
|
|
|
+ template <typename D>
|
|
|
+ requires(difference_type_arg<D, self_type> && random_access<self_type>)
|
|
|
friend auto operator-(self_type self, D off) {
|
|
|
return self -= off;
|
|
|
}
|
|
|
|
|
|
- friend auto operator-(self_type const & left, self_type const & right) requires(random_access<self_type>) {
|
|
|
+ friend auto operator-(self_type const & left, self_type const & right)
|
|
|
+ requires(random_access<self_type>)
|
|
|
+ {
|
|
|
return right.distance_to(left);
|
|
|
}
|
|
|
|
|
|
@@ -107,7 +111,9 @@ public:
|
|
|
return left.equal_to(right);
|
|
|
}
|
|
|
|
|
|
- friend auto operator<=>(self_type const & left, self_type const & right) requires(random_access<self_type>) {
|
|
|
+ friend auto operator<=>(self_type const & left, self_type const & right)
|
|
|
+ requires(random_access<self_type>)
|
|
|
+ {
|
|
|
return (left - right) <=> 0;
|
|
|
}
|
|
|
|
|
|
@@ -123,58 +129,56 @@ protected:
|
|
|
// macros.
|
|
|
#define MAKE_ITERATOR_FACADE_TYPEDEFS_T(Iter)
|
|
|
|
|
|
-template <typename It> requires std::is_base_of_v<iterator::facade<It>, It>
|
|
|
+template <typename It>
|
|
|
+ requires std::is_base_of_v<iterator::facade<It>, It>
|
|
|
struct std::iterator_traits<It> {
|
|
|
- static const It& _it;
|
|
|
+ static const It & _it;
|
|
|
using reference = decltype(*_it);
|
|
|
using pointer = decltype(_it.operator->());
|
|
|
using value_type = ::iterator::infer_value_type_t<It>;
|
|
|
using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
using iterator_category = std::conditional_t<
|
|
|
- ::iterator::random_access<It>,
|
|
|
- random_access_iterator_tag,
|
|
|
- std::conditional_t<
|
|
|
- ::iterator::bidirectional<It>,
|
|
|
- bidirectional_iterator_tag,
|
|
|
- std::conditional_t<::iterator::single_pass<It>, input_iterator_tag, forward_iterator_tag>
|
|
|
- >
|
|
|
- >;
|
|
|
+ ::iterator::random_access<It>, random_access_iterator_tag,
|
|
|
+ std::conditional_t<
|
|
|
+ ::iterator::bidirectional<It>, bidirectional_iterator_tag,
|
|
|
+ std::conditional_t<::iterator::single_pass<It>, input_iterator_tag,
|
|
|
+ forward_iterator_tag>>>;
|
|
|
};
|
|
|
|
|
|
-//template <typename It> requires(std::derived_from<It, iterator::facade<It, iterator::category::single_pass>>)
|
|
|
-//struct std::iterator_traits<It> {
|
|
|
-// using reference = decltype(std::declval<It>().operator*());
|
|
|
-// using value_type = std::decay_t<reference>;
|
|
|
-// using pointer = decltype(std::declval<It>().operator->());
|
|
|
-// using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
-// using iterator_category = std::input_iterator_tag;
|
|
|
-//};
|
|
|
+// template <typename It> requires(std::derived_from<It, iterator::facade<It,
|
|
|
+// iterator::category::single_pass>>) struct std::iterator_traits<It> {
|
|
|
+// using reference = decltype(std::declval<It>().operator*());
|
|
|
+// using value_type = std::decay_t<reference>;
|
|
|
+// using pointer = decltype(std::declval<It>().operator->());
|
|
|
+// using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
+// using iterator_category = std::input_iterator_tag;
|
|
|
+// };
|
|
|
//
|
|
|
-//template <typename It> requires(std::derived_from<It, iterator::facade<It, iterator::category::forward>>)
|
|
|
-//struct std::iterator_traits<It> {
|
|
|
-// using reference = decltype(std::declval<It>().operator*());
|
|
|
-// using value_type = std::decay_t<reference>;
|
|
|
-// using pointer = decltype(std::declval<It>().operator->());
|
|
|
-// using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
-// using iterator_category = std::forward_iterator_tag;
|
|
|
-//};
|
|
|
+// template <typename It> requires(std::derived_from<It, iterator::facade<It,
|
|
|
+// iterator::category::forward>>) struct std::iterator_traits<It> {
|
|
|
+// using reference = decltype(std::declval<It>().operator*());
|
|
|
+// using value_type = std::decay_t<reference>;
|
|
|
+// using pointer = decltype(std::declval<It>().operator->());
|
|
|
+// using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
+// using iterator_category = std::forward_iterator_tag;
|
|
|
+// };
|
|
|
//
|
|
|
-//template <typename It> requires(std::derived_from<It, iterator::facade<It, iterator::category::bidirectional>>)
|
|
|
-//struct std::iterator_traits<It> {
|
|
|
-// using reference = decltype(std::declval<It>().operator*());
|
|
|
-// using value_type = std::decay_t<reference>;
|
|
|
-// using pointer = decltype(std::declval<It>().operator->());
|
|
|
-// using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
-// using iterator_category = std::bidirectional_iterator_tag;
|
|
|
-//};
|
|
|
+// template <typename It> requires(std::derived_from<It, iterator::facade<It,
|
|
|
+// iterator::category::bidirectional>>) struct std::iterator_traits<It> {
|
|
|
+// using reference = decltype(std::declval<It>().operator*());
|
|
|
+// using value_type = std::decay_t<reference>;
|
|
|
+// using pointer = decltype(std::declval<It>().operator->());
|
|
|
+// using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
+// using iterator_category = std::bidirectional_iterator_tag;
|
|
|
+// };
|
|
|
//
|
|
|
-//template <typename It> requires(std::derived_from<It, iterator::facade<It, iterator::category::random_access>>)
|
|
|
-//struct std::iterator_traits<It> {
|
|
|
-// using reference = decltype(std::declval<It>().operator*());
|
|
|
-// using value_type = std::decay_t<reference>;
|
|
|
-// using pointer = decltype(std::declval<It>().operator->());
|
|
|
-// using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
-// using iterator_category = std::random_access_iterator_tag;
|
|
|
-//};
|
|
|
+// template <typename It> requires(std::derived_from<It, iterator::facade<It,
|
|
|
+// iterator::category::random_access>>) struct std::iterator_traits<It> {
|
|
|
+// using reference = decltype(std::declval<It>().operator*());
|
|
|
+// using value_type = std::decay_t<reference>;
|
|
|
+// using pointer = decltype(std::declval<It>().operator->());
|
|
|
+// using difference_type = ::iterator::infer_difference_type_t<It>;
|
|
|
+// using iterator_category = std::random_access_iterator_tag;
|
|
|
+// };
|
|
|
|
|
|
#include <iterator/detail/undef.h>
|