Skip to content

GuillaumeDua/CppShelf

Repository files navigation

C++ Shelf

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

πŸ”¬ functional

Function & overload traits

See project's live demo on godbolt.org, dashboard

πŸ”Ž typeinfo

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

See project's live demo on godbolt.org, dashboard

β˜” ensure

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

See project's dashboard


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