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.
π¦ 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
Library | C++17 | C++20 | C++23 |
---|---|---|---|
π¦ ag | β | β | β |
π wf | β | β | planned P1985 - Universal template parameters P0847 - Deducing this |
π§ββοΈ mp | β | β | - |
π¬ functional | β | β | β |
π typeinfo | β | β | β |
β ensure | β | β | β |
π‘ Note that implementation details might changes from a version to another,
and in some cases, the source file itself.For instance, we currently have:
<csl/ensure.hpp>
which either includes<csl/cxx_17/ensure.hpp>
, or<csl/cxx_20/ensure.hpp>
when C++20 or greater is available.
π‘ Backward compatibility with C++17 requires additional effort and IS NOT a priority for now, beside specific requests.
π See opened issue tagged with C++23.
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 | - |
π This is the recommended way to integrate csl
(or a subset of its components) to a project.
-
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)
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.
Using the way you prefer, acquire a component/library file.
wget
shell command- CMake
file(DOWNLOAD <url> [<file>] [...])
- etc.
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 });
}
See demonstration here.
#include <iostream>
#include <https://raw.githubusercontent.com/GuillaumeDua/CppShelf/main/includes/typeinfo/csl/typeinfo.hpp>
#include <https://raw.githubusercontent.com/GuillaumeDua/CppShelf/main/includes/ag/csl/ag.hpp>
struct some_model {
char c = 'A';
int i = 42;
};
auto main() -> int {
std::cout
<< csl::typeinfo::type_name_v<
csl::ag::element_t<0, some_model> // "char"
>
;
return csl::ag::get<1>(some_model{}); // 42
}
Possible output:
Program returned: 42
Program stdout
char
This Readme.md 's ressources