Skip to content

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Sep 4, 2025

This patch introduces the following utilities around relocation:

  • __relocate_at, which relocates a single object
  • a __is_nothrow_relocatable trait
  • __uninitialized_relocate and __uninitialized_relocate_backward
  • allocator-aware variants of all of those

These facilities are preliminary work towards implementing https://wg21.link/p3516, which has been design-approved but not yet voted into the Standard. This patch is careful not to introduce any new public names officially, since the TR APIs are still expected to undergo changes in the C++26 cycle.

The reason for wanting to land this patch is that it will allow reworking the implementation of vector to take advantage of relocation in more cases, while being consistent with the ongoing and future direction of trivial relocation in the Standard.

This patch introduces the following utilities around relocation:
- __relocate_at, which relocates a single object
- a __is_nothrow_relocatable trait
- __uninitialized_relocate and __uninitialized_relocate_backward
- allocator-aware variants of all of those

These facilities are preliminary work towards implementing
https://wg21.link/p3516, which has been design-approved but
not yet voted into the Standard. This patch is careful not
to introduce any new public names officially, since the TR
APIs are still expected to undergo changes in the C++26 cycle.

The reason for wanting to land this patch is that it will allow
reworking the implementation of vector to take advantage of
relocation in more cases, while being consistent with the ongoing
and future direction of trivial relocation in the Standard.
@ldionne
Copy link
Member Author

ldionne commented Sep 4, 2025

This is missing tests and I think there was a bug hidden somewhere when I last looked at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant