cxx-core-mp

Primitives for structured metaprogramming along with convenience functions for runtime-type information.

Brief Tour

Concepts and the related C++20 features generally allow for the concise expression of intent when working with types. This simplifies many type oriented tasks and reduces the need for a separate metaprogramming library. This library targets common patterns which are either complex or awkward to implement directly and attempts to provide a simple, ergonomic option.

#include "core/pp/mp.h"

Installation

git clone https://github.com/cpp-core/mp
mkdir mp/build && cd mp/build
CC=clang-mp-14 CXX=clang++-mp-14 cmake -DCMAKE_INSTALL_PREFIX=$HOME/opt ..
make -j4 check # Run tests
make install   # Do the install

To build the documentation (requires doxygen and sphinx-build to be installed):

CC=clang-11 CXX=clang++11 cmake -DCORE_DOCS ..
make cxx_core_mp_docs # root of html tree is docs/html/index.html

Background

cxx-core-mp is part of the cxx-core* family of C++20 based libraries. The cxx-core libraries have two primary goals:

  • Ergonomics. In the spirit of the CppCoreGuideLines, cxx-core aspires to facilitate writing concise, idiomatic code not by force, but by providing a clear path that produces robust, easy to read code. Good code should be fun to write.

  • Components. Modern language platforms provide broad support for first-class library components, while C++ has traditionally only provided a very minimal standard library. cxx-core aspires to provide support for a broad range of libraries that feel like part of the language.

License

This software is licensed under the BSD 3-clause license. See the LICENSE file for details.

Appendix