[clang-tools-extra] [libc] [llvm] [libunwind] [flang] [lldb] [libcxx] [clang] [compiler-rt] [libc++] Implement ranges::iota (PR #68494)

Christopher Di Bella via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 14:16:05 PST 2024


================
@@ -1172,6 +1198,22 @@ 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_incremental
+  constexpr Proxy& operator++()
+    requires(HasPreIncrementOp<T>)
+  {
+    ++data;
+    return *this;
+  }
+
+  constexpr Proxy operator++(int)
+    requires(HasPostIncrementOp<T>)
+  {
+    Proxy tmp = *this;
+    operator++();
+    return tmp;
+  }
----------------
cjdb wrote:

Please use `std::weakly_incrementable` and `std::incrementable`. You'll also need to support `void operator++(int)` for when a type is weakly incremenetable, but not incrementable.

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


More information about the cfe-commits mailing list