================
@@ -1083,6 +1083,27 @@ rvalue_iterator(T*) -> rvalue_iterator<T>;
 
 static_assert(std::random_access_iterator<rvalue_iterator<int*>>);
 
+// The ProxyDiffTBase allows us to conditionally specify 
Proxy<T>::difference_type
+// which we need in certain situations. For example when we want
+// std::weakly_incrementable<Proxy<T>> to be true.
+template <class T>
+struct ProxyDiffTBase {};
+
+template <class T>
+  requires requires { std::iter_difference_t<T>{}; }
+struct ProxyDiffTBase<T> {
+  using difference_type = std::iter_difference_t<T>;
+};
+
+// These concepts allow us to conditionally add the pre-/postfix operators
+// when T also supports those member functions. Like ProxyDiffTBase, this
+// is necessary when we want std::weakly_incrementable<Proxy<T>> to be true.
+template <class T>
+concept HasPreIncrementOp = requires(T const& obj) { ++obj; };
+
+template <class T>
+concept HasPostIncrementOp = requires(T const& obj) { obj++; };
+
----------------
cjdb wrote:

These may be better off in a local header, since they're very 
`ranges::iota`-specific.

https://github.com/llvm/llvm-project/pull/68494
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to