[libcxx-commits] [libcxx] [libc++] Implement ranges::iota (PR #68494)
Konstantin Varlamov via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Mar 31 13:26:59 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;
----------------
var-const wrote:
Perhaps I'm missing something, but it seems like it shouldn't return anything (the return type is `void`)?
https://github.com/llvm/llvm-project/pull/68494
More information about the libcxx-commits
mailing list