Version: 1.0.0-beta
CustomSTL is a C++ library project that implements core features of the C++ Standard Template Library (STL).
It provides equivalent functionality for common data structures and algorithms, making it easier to learn, compare and explore STL concepts.
Highlights
- Custom STL containers and algorithms have similar functionality to the ones provided by C++ STL standard library.
- Generic containers and algorithms – supports any type meeting specified traits.
- Decoupled design – containers + iterators + algorithms work together but are independent.
- Automatic memory management – RAII and ownership semantics are used to manage memory safely.
- Consistent, easy-to-learn API – Container and algorithm usage follows a uniform design similar to C++ STL. Simply include the headers.
- Well-tested – The project includes unit tests and builds the corresponding test executables.
Usage
STL C++ library - use exactly as the original std::
, but with custom::
namespace instead
#include "custom/vector.h"
int main()
{
custom::vector<int> myVector(10);
myVector.push_back();
myVector.push_back();
myVector.push_back();
custom::vector<int>::iterator it = myVector.begin();
++it;
return 0;
}
Headers
array
-bitset
-deque
-forward_list
-list
-vector
-map
-set
-unordered_map
-unordered_set
-pair
-tuple
-queue
-stack
-string_view
-string
algorithm
-bit
-complex
-numbers
-numeric
-iterator
-limits
-functional
-memory
chrono
-ratio
-type_traits
-utility
thread
-condition_variable
-counting_semaphore
-barrier
-mutex
-shared_mutex
- C++ Compiler: C++20 or newer (
multithreading
is disabled for non-posix thread compilers) - Build System: CMake (≥ 3.22.1), Ninja
- Testing Frameworks:
- GoogleTest (auto fetched via CMake)
# Clone the repository
git clone https://github.com/ToneGabriel/CustomSTL_CPP.git
cd CustomSTL_CPP
# Create a build directory
cmake -G "Ninja" -B build
# Build the project
cmake --build build
# Run tests
ctest --test-dir build
Or simply run the script scripts/RUN_TESTS
and the build is done automatically.
The results can be found in build/Testing/Temporary
folder.