[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 08:58:33 PDT 2024


================
@@ -1172,6 +1190,30 @@ struct Proxy {
     requires std::three_way_comparable_with<std::decay_t<T>, std::decay_t<U>> {
     return lhs.data <=> rhs.data;
   }
+
+  // Needed to allow certain types to be weakly_incrementable
+  constexpr Proxy& operator++()
+    requires(std::weakly_incrementable<std::remove_reference_t<T>>)
+  {
+    ++data;
+    return *this;
+  }
+
+  constexpr Proxy operator++(int)
+    requires(std::incrementable<std::remove_reference_t<T>>)
+  {
+    Proxy tmp = *this;
+    operator++();
+    return tmp;
+  }
+
+  void operator++(int)
+    requires(std::weakly_incrementable<std::remove_reference_t<T>> && !std::incrementable<std::remove_reference_t<T>>)
+  {
+    Proxy tmp = *this;
+    operator++();
+    return tmp;
----------------
jamesETsmith wrote:

Good catch, this function is left over from some earlier work and be scrapped altogether

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


More information about the libcxx-commits mailing list