Pagghiu/SaneCppLibraries

Platform Abstraction C++ Libraries

C++

628

2,251 commits

updated Oct 18, 2026

See the code

See what people are saying

SourceMessageScoreDate

Stack can be easily created with Vector (I can add it, thanks for the hint). I am conceptually against using Deque. If you need to keep stable addresses for objects you can use ArenaMap https://pagghiu.github.io/SaneCppLibraries/library_container...

on Sane C++ Libraries

0

Jan 28, 2024

There is a VectorSet that creates Set with an unsorted vector. I think it would be good (and easy) creating a SortedVectorSet for better performance. HashMap and proper Map are already on the roadmap https://pagghiu.github.io/SaneCppLibraries/library_container... Stack can be easily created with…

on Sane C++ Libraries

0

Jan 28, 2024

I don't think describing the build in C++ (https://pagghiu.github.io/SaneCppLibraries/library_build.htm...) can exactly be called a "sane" idea. Declarative build definitions are generally much easier to work with and scale than using an imperative language.

on Sane C++ Libraries

0

Jan 28, 2024

Of course I would have been doing the same :) The documentation here states: https://pagghiu.github.io/SaneCppLibraries/library_reflectio... Note Reflection uses more complex C++ constructs compared to other libraries in this repository. To limit the issue, effort has been spent trying not to use…

on Sane C++ Libraries

0

Jan 28, 2024

Yes, the Algorithms library is just a placeholder, as specified in the docs. https://pagghiu.github.io/SaneCppLibraries/library_algorithm... Hopefully it will get expanded with more useful algorithms, it has not been a priority in the first releases cycle.

on Sane C++ Libraries

0

Jan 28, 2024

You can do a Vector>. https://pagghiu.github.io/SaneCppLibraries/library_foundatio... I have not been working (yet) on custom allocators, but that's on the roadmap: https://pagghiu.github.io/SaneCppLibraries/library_container...

on Sane C++ Libraries

0

Jan 28, 2024

README

Windows Linux+macOS Coverage

Sane C++ Libraries

YouTube X Discord GitHub Repo stars

Sane C++ Libraries is a set of C++ platform abstraction libraries for macOS, Windows and Linux, built for Agents.

Principles:
✅ Fast compile times
✅ Bloat free
✅ Simple and readable code
✅ Easy to integrate
⛔️ No C++ Standard Library / Exceptions / RTTI
⛔️ No third party build dependencies (prefer OS API)

Libraries

Libraries are designed to be used as Single File Libraries with minimal dependencies between them and follow a strict No Allocations (*) policy.

LibraryDescriptionSingle File
Async🟨 Async I/O (files, sockets, timers, processes, fs events, tasks)Download
Async Fibers🟥 Stackful fiber I/O bridge over AsyncDownload
Async Streams🟨 Concurrently read, write and transform byte streamsDownload
Await🟨 C++20 coroutine layer over AsyncDownload
Containers🟨 Generic containers (SC::Vector, SC::SmallVector, SC::Array)Download
Containers Reflection🟨 Containers specializations for Reflection and SerializationDownload
Cryptography🟥 OS-backed symmetric cryptography primitivesDownload
Fibers🟥 Stackful cooperative task runtimeDownload
File🟩 Synchronous Disk File I/ODownload
File System🟩 File System operations (like copy / delete) for files / dirsDownload
File System Iterator🟩 Enumerates files and directories inside a given pathDownload
File System Watcher🟩 Notifications {add,remove,rename,modify} for files / dirsDownload
Foundation🟩 Primitive types, asserts, macros, Function, Span, ResultDownload
Hashing🟩 Compute MD5, SHA1 or SHA256 hashes for bytes streamsDownload
Http🟥 HTTP parser, client and serverDownload
Http Client🟥 Streaming-first HTTP client with native OS backendsDownload
Memory🟩 Custom allocators, Virtual Memory, Buffer, SegmentDownload
Plugin🟨 Minimal dependency based plugin system with hot-reloadDownload
Process🟩 Create child processes and redirect their input / outputDownload
Reflection🟩 Describe C++ types at compile time for serializationDownload
SerialPort🟨 Serial port configuration and handlingDownload
Serialization Binary🟨 Serialize to and from a binary format using ReflectionDownload
Serialization Text🟨 Serialize to / from text formats (JSON) using ReflectionDownload
Socket🟨 Synchronous socket networking and DNS lookupDownload
Strings🟩 String formatting / conversion / manipulation (UTF8 / UTF16)Download
Testing🟨 Simple testing framework used by all of the other librariesDownload
Threading🟩 Atomic, thread, mutex, semaphore, barrier, rw-lock, conditionDownload
Time🟨 Time handling (relative, absolute, high resolution)Download

Each library is color-coded to signal its status:
🟥 Draft (incomplete, WIP, works on basic test cases)
🟨 MVP (a minimum set of features has been implemented)
🟩 Usable (a reasonable set of useful features has been implemented)

Sane C++ Libraries dependencies

How to use Sane C++ Libraries in your project

Point your agent at repository Skills.

Option 1: use single file libraries

  1. Obtain a specific library:
  2. #include SaneCppLIBRARY.h in your headers
  3. #define SANE_CPP_IMPLEMENTATION + #include "SaneCppLIBRARY.h" in one of your .cpp files

See Building (user) for details on the (system) libraries to link.

Option 2: use all libraries together

  1. Clone the entire repo and add it as subfolder of your project
  2. Add SC.cpp to your build system of choice
  3. Include any public header (Libraries/[Library]/*.h)

See Building (user) for details on the (system) libraries to link.

Examples

  • SCTest Suite showcases most functionalities of all libraries. Check Building (contributor) for details.
  • Documentation page of each library embeds some examples and / or code snippets.
  • Examples showcases some basic examples like an AsyncWebServer and a more advanced SCExample an Async event loop integration with a GUI and usage of Plugin.
  • Tools is a collection of repository / code automation tools built using libraries themselves
    • Includes a fully self-hosted SC::Build build system where builds are imperatively described using C++ code, can generate XCode / Visual Studio / Make projects, and can also build directly through a native backend on macOS, Linux, and Windows.

No Allocations (*)

  • All libraries are designed to work inside user-provided memory buffers and can be used without dynamic memory allocation.
  • All libraries return error codes when running out of such memory buffers (except in containers assignment operators, where they will assert).
  • Memory and Containers are the only ones that will allocate by default, even if they support working inside fixed memory buffers (Opt-out allocation).
  • Await uses by default caller-owned fixed buffers, while virtual memory, malloc/free, and polymorphic allocators are explicit opt-in modes (Opt-in allocation).
  • Third-party container classes, including std:: ones, are fully supported (see InteropSTL for an example).
  • Memory and Containers are provided for convenience if user prefers them to std:: or to any other equivalent containers library, and they're totally optional.

Documentation

Documentation is automatically generated using Doxygen and updated at every commit to main branch.

Getting in touch

Contributing

Contributions are issue-first and agent-friendly; see CONTRIBUTING.md for the current workflow.

License

Sane C++ Libraries are licensed under the MIT License, see LICENSE.txt for more information.

Videos

On this YouTube Channel there are some videos showing bits of the development process.

Blog posts

On Sane Coding Blog there is a series of posts about this project.

Relevant yearly posts:

External

async
cpp
linux
macos
networking
no-dependencies
platform-abstraction-layer
programming
self-contained
windows

Pagghiu/SaneCppLibraries

Platform Abstraction C++ Libraries

C++

628

2,251 commits

updated Oct 18, 2026

See the code

See what people are saying

SourceMessageScoreDate

Stack can be easily created with Vector (I can add it, thanks for the hint). I am conceptually against using Deque. If you need to keep stable addresses for objects you can use ArenaMap https://pagghiu.github.io/SaneCppLibraries/library_container...

on Sane C++ Libraries

0

Jan 28, 2024

There is a VectorSet that creates Set with an unsorted vector. I think it would be good (and easy) creating a SortedVectorSet for better performance. HashMap and proper Map are already on the roadmap https://pagghiu.github.io/SaneCppLibraries/library_container... Stack can be easily created with…

on Sane C++ Libraries

0

Jan 28, 2024

I don't think describing the build in C++ (https://pagghiu.github.io/SaneCppLibraries/library_build.htm...) can exactly be called a "sane" idea. Declarative build definitions are generally much easier to work with and scale than using an imperative language.

on Sane C++ Libraries

0

Jan 28, 2024

Of course I would have been doing the same :) The documentation here states: https://pagghiu.github.io/SaneCppLibraries/library_reflectio... Note Reflection uses more complex C++ constructs compared to other libraries in this repository. To limit the issue, effort has been spent trying not to use…

on Sane C++ Libraries

0

Jan 28, 2024

Yes, the Algorithms library is just a placeholder, as specified in the docs. https://pagghiu.github.io/SaneCppLibraries/library_algorithm... Hopefully it will get expanded with more useful algorithms, it has not been a priority in the first releases cycle.

on Sane C++ Libraries

0

Jan 28, 2024

You can do a Vector>. https://pagghiu.github.io/SaneCppLibraries/library_foundatio... I have not been working (yet) on custom allocators, but that's on the roadmap: https://pagghiu.github.io/SaneCppLibraries/library_container...

on Sane C++ Libraries

0

Jan 28, 2024

README

Windows Linux+macOS Coverage

Sane C++ Libraries

YouTube X Discord GitHub Repo stars

Sane C++ Libraries is a set of C++ platform abstraction libraries for macOS, Windows and Linux, built for Agents.

Principles:
✅ Fast compile times
✅ Bloat free
✅ Simple and readable code
✅ Easy to integrate
⛔️ No C++ Standard Library / Exceptions / RTTI
⛔️ No third party build dependencies (prefer OS API)

Libraries

Libraries are designed to be used as Single File Libraries with minimal dependencies between them and follow a strict No Allocations (*) policy.

LibraryDescriptionSingle File
Async🟨 Async I/O (files, sockets, timers, processes, fs events, tasks)Download
Async Fibers🟥 Stackful fiber I/O bridge over AsyncDownload
Async Streams🟨 Concurrently read, write and transform byte streamsDownload
Await🟨 C++20 coroutine layer over AsyncDownload
Containers🟨 Generic containers (SC::Vector, SC::SmallVector, SC::Array)Download
Containers Reflection🟨 Containers specializations for Reflection and SerializationDownload
Cryptography🟥 OS-backed symmetric cryptography primitivesDownload
Fibers🟥 Stackful cooperative task runtimeDownload
File🟩 Synchronous Disk File I/ODownload
File System🟩 File System operations (like copy / delete) for files / dirsDownload
File System Iterator🟩 Enumerates files and directories inside a given pathDownload
File System Watcher🟩 Notifications {add,remove,rename,modify} for files / dirsDownload
Foundation🟩 Primitive types, asserts, macros, Function, Span, ResultDownload
Hashing🟩 Compute MD5, SHA1 or SHA256 hashes for bytes streamsDownload
Http🟥 HTTP parser, client and serverDownload
Http Client🟥 Streaming-first HTTP client with native OS backendsDownload
Memory🟩 Custom allocators, Virtual Memory, Buffer, SegmentDownload
Plugin🟨 Minimal dependency based plugin system with hot-reloadDownload
Process🟩 Create child processes and redirect their input / outputDownload
Reflection🟩 Describe C++ types at compile time for serializationDownload
SerialPort🟨 Serial port configuration and handlingDownload
Serialization Binary🟨 Serialize to and from a binary format using ReflectionDownload
Serialization Text🟨 Serialize to / from text formats (JSON) using ReflectionDownload
Socket🟨 Synchronous socket networking and DNS lookupDownload
Strings🟩 String formatting / conversion / manipulation (UTF8 / UTF16)Download
Testing🟨 Simple testing framework used by all of the other librariesDownload
Threading🟩 Atomic, thread, mutex, semaphore, barrier, rw-lock, conditionDownload
Time🟨 Time handling (relative, absolute, high resolution)Download

Each library is color-coded to signal its status:
🟥 Draft (incomplete, WIP, works on basic test cases)
🟨 MVP (a minimum set of features has been implemented)
🟩 Usable (a reasonable set of useful features has been implemented)

Sane C++ Libraries dependencies

How to use Sane C++ Libraries in your project

Point your agent at repository Skills.

Option 1: use single file libraries

  1. Obtain a specific library:
  2. #include SaneCppLIBRARY.h in your headers
  3. #define SANE_CPP_IMPLEMENTATION + #include "SaneCppLIBRARY.h" in one of your .cpp files

See Building (user) for details on the (system) libraries to link.

Option 2: use all libraries together

  1. Clone the entire repo and add it as subfolder of your project
  2. Add SC.cpp to your build system of choice
  3. Include any public header (Libraries/[Library]/*.h)

See Building (user) for details on the (system) libraries to link.

Examples

  • SCTest Suite showcases most functionalities of all libraries. Check Building (contributor) for details.
  • Documentation page of each library embeds some examples and / or code snippets.
  • Examples showcases some basic examples like an AsyncWebServer and a more advanced SCExample an Async event loop integration with a GUI and usage of Plugin.
  • Tools is a collection of repository / code automation tools built using libraries themselves
    • Includes a fully self-hosted SC::Build build system where builds are imperatively described using C++ code, can generate XCode / Visual Studio / Make projects, and can also build directly through a native backend on macOS, Linux, and Windows.

No Allocations (*)

  • All libraries are designed to work inside user-provided memory buffers and can be used without dynamic memory allocation.
  • All libraries return error codes when running out of such memory buffers (except in containers assignment operators, where they will assert).
  • Memory and Containers are the only ones that will allocate by default, even if they support working inside fixed memory buffers (Opt-out allocation).
  • Await uses by default caller-owned fixed buffers, while virtual memory, malloc/free, and polymorphic allocators are explicit opt-in modes (Opt-in allocation).
  • Third-party container classes, including std:: ones, are fully supported (see InteropSTL for an example).
  • Memory and Containers are provided for convenience if user prefers them to std:: or to any other equivalent containers library, and they're totally optional.

Documentation

Documentation is automatically generated using Doxygen and updated at every commit to main branch.

Getting in touch

Contributing

Contributions are issue-first and agent-friendly; see CONTRIBUTING.md for the current workflow.

License

Sane C++ Libraries are licensed under the MIT License, see LICENSE.txt for more information.

Videos

On this YouTube Channel there are some videos showing bits of the development process.

Blog posts

On Sane Coding Blog there is a series of posts about this project.

Relevant yearly posts:

External

async
cpp
linux
macos
networking
no-dependencies
platform-abstraction-layer
programming
self-contained
windows

Significant stargazers

Silent

1,492 followers · starred Dec 2023

Amer Koleci

414 followers · starred Jan 2024

Stephan Seitz

261 followers · starred Jan 2024

Evan Jones

73 followers · starred Dec 2023