[libcxx-commits] [libcxx] [libc++] Implement P3168R2: Give optional range support (PR #149441)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 1 09:08:36 PDT 2025


ldionne wrote:

> I can get started with something like an `upper_bound_iterator` or something of the sort which could be useful for both `inplace_vector` and `optional` once this patch gets merged in.

This is neat, I like that you identified that this would also be useful for `inplace_vector`! I suggest the name is going to be a bit difficult to nail down but let's start with something and then talk about it on the review.

> Edit: It would most likely be a two-part patch: One being a `type_aware_iterator<class _Iter, class _Container>` that wraps existing iterators, but solves the first gripe about contiguous iterators being interchangeable, and finally a `upper_bound_iter<class _Iter, size_t size>`, but I'd have to think a little more about it.

Alternatively, we could simply pass the `_Container` directly to `__upper_bound_iterator` -- that would avoid creating too many layers of wrapping which wouldn't be great for compile-times and also might complicate some optimizations we might want to apply.

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


More information about the libcxx-commits mailing list