A header-only C++20 library providing fixed-capacity, constexpr containers with identical APIs to their std equivalents.
C++ Fixed Containers is a header-only C++20 library that provides fixed-capacity versions of standard library containers like vectors, maps, and strings. It solves the problem of dynamic memory allocation by declaring container capacities at compile-time, enabling deterministic memory usage, constexpr evaluation, and direct serialization. The library is designed for scenarios where heap allocations are undesirable or impossible, such as embedded systems, real-time applications, and compile-time computation.
C++ developers working on performance-critical, embedded, or real-time systems where dynamic memory allocation is prohibited or needs to be minimized. It is also valuable for developers leveraging modern C++20 features for compile-time programming and template metaprogramming.
Developers choose C++ Fixed Containers for its zero-overhead, header-only design that provides drop-in replacements for standard containers with fixed capacities. Its unique selling points include full constexpr support, identical APIs to std containers for easy adoption, and rich enum features that enhance type safety and eliminate common enum-related errors.
C++ Fixed Containers
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Containers can be constructed, modified, and used in constant expressions, enabling compile-time computation and mutation, as shown in examples where containers are defined within constexpr lambdas.
Fixed capacities declared at compile-time eliminate dynamic allocations, providing zero heap overhead and predictable memory patterns crucial for embedded and real-time systems.
Each fixed container mirrors the API of its std counterpart, ensuring familiarity and ease of adoption without requiring developers to learn new interfaces.
Rich enums include member functions, string conversion, and eliminate sentinel values, reducing errors from uninitialized states as highlighted in the README's enum features.
Requires upfront knowledge of maximum data sizes, which can be impractical for applications with growing or unknown data volumes, leading to potential over-provisioning or runtime failures.
Mandates C++20 compliance, limiting use in projects stuck on older C++ standards and necessitating migration efforts for adoption.
As a header-only library, extensive use can increase compilation times and binary sizes, especially if not managed carefully with build systems like CMake or Bazel.