[libcxx-commits] [libcxx] [libcxx] P2278R4: implement `{basic_, }const_iterator`, and have `cbegin` et. al. return it (PR #99915)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 29 12:46:27 PDT 2024


================
@@ -222,6 +229,19 @@ constexpr bool testEmpty() {
   return true;
 }
 
+#if TEST_STD_VER >= 23
+template <class T>
+concept ConstAccessorsInvocable = requires(T& t) {
+  t.cbegin();
+  t.cend();
+};
+
+static_assert(ConstAccessorsInvocable<InputRange>);
+static_assert(ConstAccessorsInvocable<const InputRange>);
+static_assert(ConstAccessorsInvocable<NonConstInputRange>);
+static_assert(!ConstAccessorsInvocable<const NonConstInputRange>);
----------------
ldionne wrote:

We need to also actually call these new methods at runtime.

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


More information about the libcxx-commits mailing list