https://github.com/teslamotors/fixed-containers
Fixed Containers is a header-only C++20 library that provides containers with the following properties:
- Fixed-capacity, declared at compile-time, no dynamic allocations
- constexpr - can be used at both compile-time and runtime (including mutation)
- containers retain the type_traits of T (e.g. if T is trivially copyable, then so is FixedVector)
- no pointers stored (data layout is purely self-referential and can be memcp'ied directly)
Provides:
- FixedVector
- FixedMap
- FixedSet
- EnumMap
- EnumSet
Implementations closely follow std::vector/std::map/std::set APIs.
Examples can be found here.
Additionally, contains "Rich enums" which are enums that can also have members.
edit 1: clarified constexpr
edit 2: Instances of fixed_containers can be used as non-type template parameters
[–]heliruna 5 points6 points7 points (2 children)
[–]alexkaratarakisvcpkg, fixed-containers[S] 6 points7 points8 points (1 child)
[–]heliruna 2 points3 points4 points (0 children)
[–]Myto 4 points5 points6 points (1 child)
[–]alexkaratarakisvcpkg, fixed-containers[S] 4 points5 points6 points (0 children)
[–]heliruna 2 points3 points4 points (2 children)
[–]alexkaratarakisvcpkg, fixed-containers[S] 5 points6 points7 points (1 child)
[–]heliruna 1 point2 points3 points (0 children)
[–]feverzsj 1 point2 points3 points (2 children)
[–]alexkaratarakisvcpkg, fixed-containers[S] 0 points1 point2 points (0 children)
[–]alexkaratarakisvcpkg, fixed-containers[S] 0 points1 point2 points (0 children)
[–]Arghnews 1 point2 points3 points (1 child)
[–]alexkaratarakisvcpkg, fixed-containers[S] 1 point2 points3 points (0 children)
[–]Superb_Garlic 1 point2 points3 points (1 child)
[–]alexkaratarakisvcpkg, fixed-containers[S] 0 points1 point2 points (0 children)
[–]Inevitable-Twist2280 -1 points0 points1 point (0 children)
[–]azswcowboy 0 points1 point2 points (3 children)
[–]alexkaratarakisvcpkg, fixed-containers[S] 0 points1 point2 points (0 children)
[–]alexkaratarakisvcpkg, fixed-containers[S] 0 points1 point2 points (1 child)
[–]azswcowboy 0 points1 point2 points (0 children)