Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P0843R14 <inplace_vector> #4766

Open
StephanTLavavej opened this issue Jun 30, 2024 · 4 comments
Open

P0843R14 <inplace_vector> #4766

StephanTLavavej opened this issue Jun 30, 2024 · 4 comments
Labels
cxx26 C++26 feature

Comments

@StephanTLavavej
Copy link
Member

StephanTLavavej commented Jun 30, 2024

WG21-P0843R14 <inplace_vector>

Feature-test macro:

#define __cpp_lib_inplace_vector 202406L

Note: We're focused on implementing the remaining library-only features in C++23. Until that's done, we will NOT be accepting PRs for C++26 features.

@vasama
Copy link
Contributor

vasama commented Jul 21, 2024

I have implemented this here: https://github.com/vasama/MSSTL/tree/feature/inplace_vector

When you start accepting C++26 features, I will be happy to reopen and update my PR.
Please comment in this issue so that I receive a notification about it.

@frederick-vs-ja
Copy link
Contributor

A proxy object for container/iterator debugging will make the container totally non-trivial, which is fine for all containers but array and inplace_vector. The problem is more severe for inplace_vector because the valid range of an inplace_vector object can vary among its lifetime.

Do we want to add a proxy object (but shouldn't be dynamically allocated if added) for debugging when it's allowed to do so?

@StephanTLavavej
Copy link
Member Author

Dynamically allocated proxy objects are a bane, and we should avoid adding any more.

There's no point in container-internal proxy objects - their whole purpose is to allow iterators to find their parents after swapping/moving. (Note the distinction between them and sentinel nodes. Container-internal sentinel nodes work because they don't remain valid after swapping/moving.)

@vasama
Copy link
Contributor

vasama commented Aug 8, 2024

In my implementation the debug iterator currently contains a pointer directly to the size member of the inplace_vector, which is a null pointer in the case of zero capacity. This is used by the iterator itself to detect out-of-bounds accesses. The vector itself detects its own iterators using the data pointer also stored in the iterator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cxx26 C++26 feature
Projects
Status: Unimplemented
Development

No branches or pull requests

3 participants