cpp_weekly
cpp_weekly copied to clipboard
C++26 inplace_vector
Channel
C++Weekly
Topics
<inplace_vector> has just been accepted for C++26!
- What is it?
- "A dynamically-resizable vector with fixed capacity and embedded storage"
- Why is it useful (generally)?
- Embedded
- Avoiding allocation
- Non-default constructible objects (vs. std::array)
- What does it replace?
std::array+ "size"- Returning variable length results from functions, without having to allocate
- Available implementations?
- Reference implementation provided by paper godbolt.
- Until added to compilers, available as
boost::container::static_vector. - Potentially expand to cover other containers available in
boost::containersuch assmall_vector?
Length
Bite-sized (5-10 minutes)