/CppShelf

Collection of powerfuls - C++ Single-Header Libraries Files

Primary LanguageC++MIT LicenseMIT

C++ Shelf

Fork me on GitHub Check documentation on GitHub-pages

cmake-Ubuntu-clang cmake-Ubuntu-gcc
pages-build-deployment Deploy-doc-to-GitHub-Pages
GitHub license GitHub top language GitHub issues GitHub commit activity


Collection of - Single-Header, header-only, C++ libraries files.
Personal incubator for various library ideas and experiences, and perhaps a hint of serendipity.

The libraries here could, once mature enough, become self-contained in a separated repository.


Components - nested librairies

📦 ag

A tuple-like interface for aggregates type.

Project's documentation, dashboard

🌊 wf

Generic eDSL builder - as a route pattern - to best translate workflow/use-cases in C++

See project's documentation, dashboard

🧙‍♂️ mp

A collection of C++ TMP (C++ template-metaprogramming) utilities

Project's dashboard

Function & overload traits

See project's live demo on godbolt.org

Compile-time demangler, for types & values.
Inconsistent: for educational and debugging purpose only.

See project's live demo on godbolt.org

ensure

Interface-safety related components, including a configurable strong-type implementation.


Supported C++ standard

Library C++17 C++20 C++23
📦 ag -
🌊 wf planned
P1985 - Universal template parameters
P0847 - Deducing this
🧙‍♂️ mp -
🔬 functional -
🔎 typeinfo -
☔ ensure -

About C++17 support

💡 Backward compatibility with C++17 requires additional effort and IS NOT a priority for now, beside specific requests.

About C++23 support

⚠️ Implementations details might change when C++23 is fully supported by compiliers.
👉 See opened issue tagged with C++23.

Supported compilers

Compiler Min. version Recommended Reason
g++ >= 11.1.0 >= 13.2 C++20
clang++ >= 13.0.1 >= 16.0.6 C++20
Decent support of P0315r4 lambdas in unevaluated contexts
msvc-cl TBD TBD -

Getting started

Getting started - using CMake

👉 This is the recommended way to integrate csl (or a subset of its components) to a project.

  • FetchContent

    include(FetchContent)
    
    # Forces csl a options ...
    # example: set(CSL_ENABLE_ALL_TESTS OFF CACHE INTERNAL "")
    
    FetchContent_Declare(
        csl
        GIT_REPOSITORY https://github.com/GuillaumeDua/CppShelf.git
    )
    FetchContent_MakeAvailable(csl)
  • ExternalProject_Add

CMake - options

General options:

Option Type Default Description
CSL_BUILD_ALL bool ON enable/disable all components build
CSL_ENABLE_ALL_TESTS bool OFF enable/disable all components tests
CSL_ENABLE_ALL_EXAMPLES bool OFF enable/disable all components examples

Components-specific options:

Option syntax Type Default Description
CSL_BUILD_\<component_name\> BOOL CSL_BUILD_ALL enable/disable a specific component build
CSL_TEST_\<component_name\> BOOL CSL_ENABLE_ALL_TESTS enable/disable a specific component test
CSL_EXAMPLE_\<component_name\> BOOL CSL_ENABLE_ALL_EXAMPLES enable/disable a specific component example

For options related to a specific component, refer to its dedicated documentation.

Getting started - header-only

Using the way you prefer, acquire a component/library file.

Use it in your project using an #include preprocessor directive.
Refer to the component's documention to check for configuration preprocessor constant.

Example:

#define CSL_ENSURE__ENABLE_FMT_SUPPORT // enable `fmt` support, if available
#include <csl/ensure.hpp>

void func(){
    using meters = csl::ensure::strong_type<int, struct meter_tag>;
    fmt::print(meters{ 42 });
}

Misc

This Readme.md 's ressources