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

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 29 09:51:03 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;
----------------
cjdb wrote:

Nit: pass by value (same elsewhere for types that you wouldn't ordinarily pass by ref-to-const).

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


More information about the libcxx-commits mailing list