[libcxx-commits] [libcxx] [libc++] Implement ranges::iota (PR #68494)

James E T Smith via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 1 18:47:52 PDT 2024


================
@@ -1114,6 +1114,23 @@ 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 {
+  // Add default `operator<=>` so that the derived type, Proxy, can also use the default `operator<=>`
+  friend constexpr auto operator<=>(const ProxyDiffTBase&, const ProxyDiffTBase&) = default;
----------------
jamesETsmith wrote:

I agree it seems a bit unnecessary to pass by ref-to-const here, but I was basing these on the existing `Proxy<T>` which uses ref-to-const

https://github.com/llvm/llvm-project/pull/68494


More information about the libcxx-commits mailing list