Article

The C++26 inplace_vector container

Marius Bancila ·Marius Bancila's Blog ·Published 2026-10-24 ·5 min read

This article discusses the new std::inplace_vector container introduced in C++26, which combines features of std::array and std::vector. It explains how it works and when to use it.

From the article

The C++26 standard features a new container called std::inplace_vector , that sits in between the std::array and std::vector containers. It’s a container with a compiled-time fix capacity – like std::array , but a runtime variable size – like std::vector . In this article, we will discuss how it works and when to use it.

Before we discuss std::inplace_vector , let’s briefly look at the other two mentioned containers:

There are cases were you need the semantics of std::array for a fixed (maximum) number of elements, but mixed with those of std::vector for being able to increase and decrease the capacity. If you use a std::array , you need to use an additional counter that you increment and decrement as elements are added or removed. But decrementing the counter does not destruct the…


Share this resource


Discovered 2026-10-26 Source Marius Bancila's Blog Archive 2026-10 →