Strongly Typed Containers
summary
Compares four header-only libraries (typesafe / named_type / strong_type / strong_typedef) and finds them functionally similar, MIT/BSL licensed, but each trades verbosity for flexibility; microbenchmarks show about 10% overhead versus raw std::vector in a push_back loop. Recommends avoiding public inheritance from STL (no virtual destructor) and prefers composition over public inheritance or private inheritance only rarely; aliasing is cheap but not type-safe. Open-source options are usable for apps, corporations may prefer an internal implementation.
AI-written summary · about
chapters (4)
- 0:00Start
- 5:10What is the problem here?
- 9:10A sample implementation of a "strong type"
- 52:52What about the performance?
related talks
41m“Avoiding Disasters with Strongly Typed C++”
01h 13mType safe C++ – LOL! :-)
01h 31mDesigning a Slimmer Vector of C++ Variants
01h 31mNew (& Old) C++ Standard Library Containers - How to Choose the Right Container in C++26 and Beyond
52musing namespace std;
32mC++ Standard Library "Little Things”
37mEnhancing STL containers
50mType safe C++? LOL!
