Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Filter by
Sorted by
Tagged with
2 votes
0 answers
144 views

Accessing objects of implicit lifetime type in the storage provided by std::allocator, before any explicit construction

This question rises for a discussion of the answer to another question about allocation in constexpr context. cppreference states that std::allocator<T>::allocate(std::size_t n) allocates an ...
Oersted's user avatar
  • 3,581
5 votes
1 answer
186 views

Why are [[no_unique_address]] members not transparently replaceable?

In the classic talk An (In-)Complete Guide to C++ Object Lifetimes by Jonathan Müller, there is a useful guideline as follows: Q: When do I need to use std::launder? A: When you want to re-use the ...
xmllmx's user avatar
  • 44.5k
1 vote
2 answers
211 views

Searching for clarity about C++20 strict aliasing in a custom allocator for implicit lifetime types

Let's say I have an allocator which gives out entire cachelines per request. So each allocation will begin on a new cacheline. constexpr auto L1 = std::hardware_destructive_interference_size; std::...
rad's user avatar
  • 93
8 votes
1 answer
389 views

An aggregate is implicit lifetime? Doesn't seem right

According to this and this an aggregate is implicit lifetime. A class S is an implicit-lifetime class if it is an aggregate or has at least one trivial eligible constructor and a trivial, non-deleted ...
doug's user avatar
  • 4,319