C++ Metaprogramming Primivites and Pattern implementations.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jens Finkhaeuser 1ba75dd166
Maybe needs a rethink for travis; we'll see.
4 years ago
CMakeModules - Make Findcppunit detect debug vs. release libraries 6 years ago
data Add CPack information to the CMakeLists.txt file; seems to work for 6 years ago
debian Fix address in debian changelog 6 years ago
meta More efficient hash combine 5 years ago
scripts Replace dependency installation scripts with external repo 6 years ago
test Remove use of META_ENUM_CLASS* macros and rewrite code to use constants 6 years ago
.gitignore Ignore package directory 6 years ago
.gitmodules Replace dependency installation scripts with external repo 6 years ago
.travis.yml Maybe needs a rethink for travis; we'll see. 4 years ago
AUTHORS.md Fix author email 6 years ago
CMakeLists.txt - Simplify compiler flag handling; allows compiler flags to be set by 6 years ago
LICENSE Checkpoint commit for change over to CMake 9 years ago
NEWS Info file boilerplate 10 years ago
README.md Fix PPA URL 6 years ago
build.sh Successful builds in chroot should result in zero exit code 6 years ago
darwin.txt Add Darwin dependencies 6 years ago
linux.txt The -o flag to uname is not portable 6 years ago
meta.pc.in Honour CMAKE_INSTALL_LIBDIR in pkgconfig file 6 years ago
package.sh.in Follow source tarball renaming in CMakeLists.txt 6 years ago



C++ Metaprogramming Primivites and Pattern implementations.

Build Status

This library is kept deliberately small, with no external dependencies.

  • for.h provides compile-time for loops
  • comparison.h provides compile-time comparators
  • noncopyable.h provides a non-copyable base class
  • mandatory.h provides code for enforcing checking of return types
  • byteorder.h provides compiler-/platform-independent versions of ntoh/hton for integer types (including 64 bits)
  • pointers.h provides policies for shallow-copying/deep-copying pointer members.
  • typelist.h provides constructs for constructing and manipulating lists of types.
    • typelist is a list of types with no value to itself.
    • inheritancelist inherits from all types and therefore does not work with POD types.
    • compositionlist composes all types and therefore does work with POD types.
  • condition.h types for compile-time composition of condition chains with conditions being either stateless or stateful.
  • math.h for some simple compile-time mathematics, such as keeping a ratio of two numbers and converting into another ratio, etc.
  • nullptr.h for nullptr support in compilers that don't know it yet.
  • singleton.h for a simple singleton implementation.
  • restricted.h and restrictions.h for types that allow only certain ranges of values to be assigned to them; you can use them in a function prototype to enforce a contract, for example.

Some of these bits of code started out as mental exercises, so there's no guarantee for usefulness implied in providing them. See COPYING for details.

Tested On

Operating Systems

  • Linux
  • OS X
  • Windows
  • FreeBSD


  • x86_64
  • Arm (hardfloat)
  • MIPS (big endian)


  • GCC
  • CLang
  • Visual Studio


There are external dependencies, but only for testing:

  • CMake for the build system.
  • CppUnit for the unit test framework.

Similarly, external dependencies for building on CI are:

Installation (Ubuntu)

Follow the instructions to add the Ubuntu PPA to your system. Then run (as root):

apt-get install libmeta-dev

This will install the (empty) binary package file as well as the development headers.


After installing the requirements, run:

$ cmake .

This will configure the build system. Usually, you can just run the following commands to get going:

$ make testsuite && ./testsuite

Build Types

CMake already defines the Release and Debug build types. In addition to these, meta offers a Coverage build type which is largely indentical to Debug, but with GCC offers code coverage generation.

To specify a build type, use e.g.

$ cmake . -DCMAKE_BUILD_TYPE=Coverage

For compiling code coverage information, just run the coverage target:

$ make coverage

C++ Compatibility

This library is mostly written with C++11 features in mind, but some of it's code can also compile in C++98. A few headers can be compiled in either mode.

To force meta into building only c++98 compatible tests, invoke cmake like this:

$ cmake -DMETA_USE_CXX11=OFF .

Similarly, if you're including meta headers into your C++98 project, make sure to set the same define - either before the include statement, or on the command line.

CI Building

The build.sh script uses build-chroot and build-dependencies to create a suitable build environment on CI, possibly on emulated hardware.

Run e.g.

$ ./build.sh x86_64
$ ./build.sh mips




See Authors.