[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


================
@@ -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 {
----------------
cjdb wrote:

As a rule of thumb, I don't mind duplication in tests so that things are known to be correct on inspection. Abstraction is fine, but only if it doesn't cast doubt on our confidence that the test is correct.

I think in this case, I'd prefer a `proxy_with_difference_type` and `proxy_missing_difference_type`. That might be deserving of its own PR, and before this one is merged so you can use it.

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


More information about the libcxx-commits mailing list