Skip to content

_LIBCPP_ABI_BOUNDED_ITERATORS support for std::string and std::vector #78805

@davidben

Description

@davidben

There is iterator support for std::string_view and std::span, but not the corresponding containers. It'd be cool to extend it to that.

I don't know why they weren't added there, but I have a guess. Was it because you're allowed to push_back on a std::string or std::vector, up to capacity(), without invalidating iterators? And then I guess std::vector's promise of pointer stability after move means the iterator can't just retain a pointer back to the parent container.

In that case, perhaps the wrapped iterator could be sized based on the capacity, rather than the length? It's a weaker check than is ideal, but at least it means you can't run off the end of the allocation.

Metadata

Metadata

Assignees

Labels

hardeningIssues related to the hardening effortlibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions