https://github.com/jlaumon/bedrock
Minimal C++20 STL replacement library. Simpler, smaller, and in many cases faster.
https://github.com/jlaumon/bedrock
allocators atomic cpp cpp20 hashmap string thread vector
Last synced: about 1 month ago
JSON representation
Minimal C++20 STL replacement library. Simpler, smaller, and in many cases faster.
- Host: GitHub
- URL: https://github.com/jlaumon/bedrock
- Owner: jlaumon
- License: mpl-2.0
- Created: 2024-09-29T11:35:44.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-03-31T19:48:58.000Z (about 2 months ago)
- Last Synced: 2025-04-05T08:02:30.165Z (about 1 month ago)
- Topics: allocators, atomic, cpp, cpp20, hashmap, string, thread, vector
- Language: C++
- Homepage:
- Size: 634 KB
- Stars: 172
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bedrock 🪨
Bedrock is a C++20 STL alternative. Smaller, simpler, in many case faster. It's a hobby project, don't expect much more than an interesting implementation reference for things.
Currently Windows only. Supports MSVC and Clang. There are no concrete plans to support more platforms/compilers at this time.
## Containers and Views
```c++
Vector // Roughly equivalent to std::vector, with extra useful methods (Find, SwapErase, etc.)
Span // Roughly equivalent to std::span
String // Roughly equivalent to std::string
StringView // Roughly equivalent to std::string_view
HashMap // Dense open addressed (Robin Hood) hash map. Key-value pairs are stored contiguously.
HashSet // Same as HashMap, but without values.
```## Allocators
All containers come in different allocator flavors:
```c++
TempVector // Allocates from a thread local arena. Falls back to the heap if it runs out.
FixedVector // Allocates from a fixed-size arena embedded in the container.
VMemVector // Allocates from a virtual memory arena embedded in the container. Can grow while keeping a stable address.
ArenaVector // Allocates from an externally provided arena.```
## Tests
Write tests anywhere:
```c++
REGISTER_TEST("Span")
{
int values[] = { 1, 2, 3, 4, 5 };
Span test = values;Span first_two = test.First(2);
TEST_TRUE(first_two.Size() == 2);
TEST_TRUE(first_two[0] == 1);
TEST_TRUE(first_two[1] == 2);
};
```The run them with `gRunAllTests()`.
## Other
Mutex, Atomic, Thread, Semaphore.
Function, many Type Traits, a few Algorithms...## Building
Compile every cpp file in Bedrock/. Define `ASSERTS_ENABLED` if you want asserts and tests. That's about it.