[libcxx-commits] [libcxx] [libc++] Use __wrap_iter in string_view and array in the unstable ABI (PR #74482)
Christopher Di Bella via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 5 16:09:20 PST 2024
cjdb wrote:
If it's causing lots of pain, would it be possible to make this opt-in for two releases, then switch it to opt-out (and document that we'll be doing this no later than two releases time)? That'll give folks time to address this issue without being broken today.
To avoid having users need to either modify `__config` or need to maintain an unbounded set of macros, what do you think about flipping the macro? Then users who don't want/can't yet use this only need to add one macro instead of many.
```cpp
#if defined(_LIBCPP_ABI_BOUNDED_ITERATORS)
using const_iterator = __bounded_iter<const_pointer>;
#elif defined(_LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW)
using const_iterator = __wrap_iter<const_pointer>;
#else
using const_iterator = const_pointer;
#endif
```
to
```cpp
#if defined(_LIBCPP_ABI_BOUNDED_ITERATORS)
using const_iterator = __bounded_iter<const_pointer>;
#elif !defined(_LIBCPP_ABI_NO_USE_WRAP_ITER_IN_STD_STRING_VIEW) // macro adds "NO"
using const_iterator = const_pointer;
#else
using const_iterator = __wrap_iter<const_pointer>;
#endif
```
Apologies for not thinking of this when we chatted last week.
https://github.com/llvm/llvm-project/pull/74482
More information about the libcxx-commits
mailing list