compact_optional
A template for creating optional-like object with no space overhead (by akrzemi1)
tiny-optional
Replacement for std::optional that does not waste memory unnecessarily (by Sedeniono)
Our great sponsors
compact_optional | tiny-optional | |
---|---|---|
1 | 3 | |
25 | 92 | |
- | - | |
10.0 | 6.9 | |
over 6 years ago | 11 days ago | |
C++ | C++ | |
- | Boost Software License 1.0 |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
compact_optional
Posts with mentions or reviews of compact_optional.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-10-23.
-
tiny::optional – a C++ optional that does not waste memory
Or there's this from 2015: https://github.com/akrzemi1/compact_optional
tiny-optional
Posts with mentions or reviews of tiny-optional.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-12-15.
-
Is bloat in std::unexpected expected?
There are several implementations of compact optionals, see https://github.com/Sedeniono/tiny-optional, and related work & reddit thread.
-
tiny::optional – a C++ optional that does not waste memory
tiny::optional is a header-only C++ library for x86/x64 intended to be a drop-in replacement for std::optional with the twist that it does not require additional memory for bools, floats, doubles and raw pointers. For example, a std::optional has twice the size of a raw double because of 7 padding bytes after the internal bool. These wasted bytes can have a notable impact on performance in memory bound applications. On the other hand, a tiny::optional has the size of a double by exploiting unused bit patterns (i.e. by exploiting platform specific behavior).
- Show HN: Tiny:optional – a C++ optional that does not waste memory
What are some alternatives?
When comparing compact_optional and tiny-optional you can also consider the following projects:
tiny - low-level library for minimizing the size of your types
cmake-init - The missing CMake project initializer
dynamap - Thread-safe and dynamically resized hash map for C++ (header-only)
libCat - 🐈⬛ A runtime for C++26 w/out libC or POSIX. Smaller binaries, only arena allocators, SIMD, stronger type safety than STL, and value-based errors!