cpp_weekly icon indicating copy to clipboard operation
cpp_weekly copied to clipboard

C++26 inplace_vector

Open nebkat opened this issue 1 year ago • 1 comments

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::container such as small_vector?

Length

Bite-sized (5-10 minutes)

nebkat avatar Jul 01 '24 18:07 nebkat

This is the kind of stuff one would wrongly assume C++ would take less than 40 years to implement. /hj

fcolecumberri avatar Jul 05 '24 00:07 fcolecumberri