My implementation of C++ containers with modern C++23
Each typical C++ std library (i.e. vector, queue, etc...) has it's own directory under the project root directory
- At the root level, use the make commands to build all libraries
make all- or choose certain targets to build:
make memory- The flag
-DCMAKE_CXX_COMPILER=g++-14should not be needed
- Triggering the workflow to build and publish a release requires a
git tagpush - Create and push a tag:
git tag -a v1.0.0 -m "First release version"
git push origin --tagsNote the tag version must be higher than the current tag
This project uses Google Test framework for unit testing. Each module (memory, vector, etc.) has its own test suite in its tests/ directory.
You can run tests in several ways:
- Run all tests without rebuilding:
make unittest- Is not verbose with output
- Run tests for a specific module:
make memory UNITTEST=true # Run memory module tests only
make vector UNITTEST=true # Run vector module tests only- Automatically is verbose with messages and any
couts
- Run all tests:
make all UNITTEST=true- Automatically is verbose with messages and any
couts
Each module follows this test structure:
- Basic functionality tests
- Edge case tests
- Move semantics tests (for modern C++ features)
- Custom behavior tests (e.g., custom deleters)
- Performance benchmarks
- Create test files in the module's
tests/directory - Name test files as
<component>_test.cpp - Use Google Test macros for assertions:
EXPECT_EQ()for equalityEXPECT_NE()for inequalityEXPECT_TRUE()for boolean conditionsEXPECT_THROW()for exception testing
- CMake must be greater than version 3.30 for C++23 features
sudo apt install cmake
sudo apt install ninja-build- Follow this answer to get the latest version: https://askubuntu.com/a/1157132
- On my WSL2, I simply ran the command to upgrade my Ubuntu version to 24.04:
sudo do-release-upgrade -d- The
-dgives the developer version of the latest - Ubuntu 24.04 already comes with g++-13
sudo apt-get update
sudo apt-get install g++-14
g++ --version- If the version of g++ is still not >= 14, do the following step
/usr/bin/g++is a symlink to the active g++ version being used- Remove it and create a new symlink to g++-14
file /usr/bin/g++
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/g++-14 /usr/bin/g++
g++ --version- Now the version should be >= 14