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¶
- include/
- core/
- mp/
- traits/
- append.h
- array.h
- array_from_pack.h
- at.h
- cat.h
- constants.h
- contains.h
- enable_if.h
- find_index.h
- foreach.h
- generate.h
- homogeneous.h
- if.h
- intersect.h
- iterator.h
- list.h
- make_index_range.h
- map_find.h
- meta.h
- mp.h
- nth.h
- permutation.h
- product.h
- push_front.h
- remove.h
- same.h
- sort.h
- subset.h
- subtract.h
- swap.h
- transform.h
- type_name.h
- union.h
- unique.h
- mp/
- core/
- test/
- src/
- core/
- mp/
- traits/
- test_mp_append.cpp
- test_mp_array.cpp
- test_mp_array_from_pack.cpp
- test_mp_at.cpp
- test_mp_cat.cpp
- test_mp_contains.cpp
- test_mp_enable_if.cpp
- test_mp_find_index.cpp
- test_mp_foreach.cpp
- test_mp_generate.cpp
- test_mp_homogeneous.cpp
- test_mp_if.cpp
- test_mp_intersect.cpp
- test_mp_is_integral_constant.cpp
- test_mp_is_subset_of.cpp
- test_mp_iterator.cpp
- test_mp_list.cpp
- test_mp_make_index_range.cpp
- test_mp_map_find.cpp
- test_mp_nth.cpp
- test_mp_permutation.cpp
- test_mp_product.cpp
- test_mp_push_front.cpp
- test_mp_remove.cpp
- test_mp_same.cpp
- test_mp_sort.cpp
- test_mp_subtract.cpp
- test_mp_swap.cpp
- test_mp_transform.cpp
- test_mp_type_name.cpp
- test_mp_union.cpp
- test_mp_unique.cpp
- mp/
- core/
- src/