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

James E T Smith via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 28 11:54:40 PDT 2024


================
@@ -1083,6 +1083,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 {
----------------
jamesETsmith wrote:

The base class allows us to have the specialization for types that have `std::iter_difference_t` in a cleaner way. I think you're right that the base class isn't strictly necessary, but we'd have a lot of duplicate code with we implemented specialization for the `Proxy` class

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


More information about the libcxx-commits mailing list