[libcxx-commits] [libcxx] [libc++] Resolve LWG4308: `std::optional<T&>::iterator` can't be a contiguous iterator for some T (PR #173948)
William Tran-Viet via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 29 23:07:04 PST 2025
================
@@ -19,6 +19,12 @@
#include <type_traits>
#include <utility>
+template <typename T>
+concept has_iterator = requires {
+ typename T::iterator;
+ typename T::const_iterator;
+};
+
----------------
smallp-o-p wrote:
I'm assuming the later comment regarding `optional<T&>` and `const_iterator` may affect this and whether it should be done in this PR? I'm assuming we'd just need to check for `optional<T&>` that it has `iterator` and not `const_iterator`.
https://github.com/llvm/llvm-project/pull/173948
More information about the libcxx-commits
mailing list