[libcxx-commits] [libcxx] [libc++] Assert that the position passed to insert and emplace is in [begin(), end()] (PR #230490)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 12 20:54:14 PDT 2026
================
@@ -453,6 +453,11 @@ class _LIBCPP_WARN_UNUSED vector<bool, _Allocator> {
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
__insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+ __is_valid_insert_position(const_iterator __position) const _NOEXCEPT {
+ return begin() <= __position && __position <= end();
----------------
frederick-vs-ja wrote:
Can we transform this into something using `__is_pointer_in_range`?
https://github.com/llvm/llvm-project/pull/230490
More information about the libcxx-commits
mailing list