Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gyuro/cpp-mimicking-lab

Repository files navigation

cpp-mimicking-lab

C++20-oriented std-mimicking primitives implemented from scratch under namespace nonstd.

This project focuses on practical, inspectable implementations with fixed-capacity variants where appropriate.

Design Direction

  • Namespace: nonstd
  • Naming: aligned with standard library naming when available (array, vector, deque, queue, stack, map, multimap, set, multiset, unordered_set, unordered_multiset, unordered_map, span, pair, priority_queue, optional, variant, bitset, unique_ptr, shared_ptr, weak_ptr, jthread) plus pragmatic extensions like devector, small_vector, stable_vector, spsc_queue, intrusive_list, intrusive_queue, intrusive_stack, and intrusive_slist
  • Test style: Given / When / Then scenario naming
  • Coverage direction: containers + general utilities + algorithms + memory management (C++20-era scope inspired by cppreference domains)

Implemented Surface (summary)

  • Containers: sequence/adaptor/associative/unordered families (array, vector, small_vector, stable_vector, deque, devector, circular_buffer, forward_list, list, intrusive_list, intrusive_queue, intrusive_stack, intrusive_slist, queue, stack, priority_queue, map, multimap, set, multiset, unordered_*, string, span, bitset)

  • Utilities: optional, expected / unexpected, any, scope_exit family, pair, tuple, variant, fixed-capacity function, non-owning function_ref, fixed-capacity move-only move_only_function

  • Memory: unique_ptr, shared_ptr / weak_ptr, intrusive_ptr + intrusive_ref_counter, observer_ptr, memory primitives, memory_resource + polymorphic_allocator

  • Concurrency: thread_pool, jthread, spsc_queue, latch, counting_semaphore / binary_semaphore, barrier, shared_mutex, stop_source / stop_token / stop_callback

  • Algorithms: search/count, predicates, transform/copy, ordering, partition/reverse, heap helpers, min/max/clamp

  • Canonical umbrella headers:

    • nonstd/containers
    • nonstd/associative
    • nonstd/unordered
    • nonstd/utilities
    • nonstd/algorithms
    • nonstd/memory
    • nonstd/concurrency
    • nonstd/all

For authoritative details and at-a-glance coverage, see FEATURES.md.

Build

cmake --preset default
cmake --build --preset default

(Manual fallback)

cmake -S . -B build
cmake --build build

Test

ctest --preset default

(Manual fallback)

ctest --test-dir build --output-on-failure

Run examples

# Build first, then run any produced example binary
cmake --build --preset default

# discover built examples
find build -maxdepth 1 -type f -name '*_example' -printf '%f\n'

# sample runs
./build/array_example
./build/thread_pool_example
./build/latch_example
./build/semaphore_example
./build/spsc_queue_example

Project Layout

  • include/nonstd/ — std-style header surface for nonstd primitives
  • tests/ — scenario-style executable tests (Given/When/Then naming)
  • examples/ — focused usage samples
  • FEATURES.md — authoritative implemented feature index and roadmap

CI Pipeline Stages

GitHub Actions pipeline (.github/workflows/ci.yml) runs these jobs:

  1. container-guard — enforces nonstd internal container policy
  2. cppcheck — static analysis via scripts/ci_cppcheck.sh
  3. tidy-format — clang-format check + clang-tidy check
  4. gtest — GoogleTest build and execution for all tests/test_*.cpp
  5. coverage — gcovr coverage report generation + artifact upload
  6. sanitizers — ASan/UBSan build and test run
  7. packaging — smoke + CPack TGZ artifact upload (gated by all prior jobs)

Packaging

cmake -S . -B build
cmake --build build
cpack --config build/CPackConfig.cmake -G TGZ

Notes

  • CMake auto-discovers tests/test_*.cpp and examples/*_example.cpp.
  • All tests are GoogleTest-based and run through CTest discovery.
  • Current container implementations are intentionally fixed-capacity in several cases for deterministic behavior and clear ownership semantics.

About

Daily C++ mimicking primitives and systems patterns

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages