C++26: std::inplace_vector

2 months ago by lysdexic to c/cpp

C++26 is generous with new containers — we’re getting both std::hive and std::inplace_vector. In this post, we’ll look at the latter. Until C++26, the standard library had no vector-like container with compile-time fixed capacity whose element storage is guaranteed to live inside the container object itself. std::vector obtains storage through its allocator — typically the heap. std::array has a fixed size. If you need a dynamically-resizable array that never allocates — because you’re on bare metal, because allocation latency is unacceptable, or because you need the data to live inside the object for serialization — there was no standard answer.…
basiliscos2 1 point 2 months ago

nice to know! Please, continue posting new things in modern c++ )

path: 0 25537283, hotness: undefined, score: 1, children: 0
cpp
cpp

@programming.dev

login for more options
2380
415
47

The center for all discussion and news regarding C++.

Rules

  • Respect instance rules.
  • Don't be a jerk.
  • Please keep all posts related to C++.

go to feed...