|
4 years ago | |
---|---|---|
CMakeModules | 6 years ago | |
data | 6 years ago | |
debian | 6 years ago | |
meta | 5 years ago | |
scripts | 6 years ago | |
test | 6 years ago | |
.gitignore | 6 years ago | |
.gitmodules | 6 years ago | |
.travis.yml | 4 years ago | |
AUTHORS.md | 6 years ago | |
CMakeLists.txt | 6 years ago | |
LICENSE | 9 years ago | |
NEWS | 10 years ago | |
README.md | 6 years ago | |
build.sh | 6 years ago | |
darwin.txt | 6 years ago | |
linux.txt | 6 years ago | |
meta.pc.in | 6 years ago | |
package.sh.in | 6 years ago |
README.md
meta
C++ Metaprogramming Primivites and Pattern implementations.
This library is kept deliberately small, with no external dependencies.
for.h
provides compile-time for loopscomparison.h
provides compile-time comparatorsnoncopyable.h
provides a non-copyable base classmandatory.h
provides code for enforcing checking of return typesbyteorder.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
fornullptr
support in compilers that don't know it yet.singleton.h
for a simple singleton implementation.restricted.h
andrestrictions.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
Hardware
- x86_64
- Arm (hardfloat)
- MIPS (big endian)
Compilers
- GCC
- CLang
- Visual Studio
Requirements
There are external dependencies, but only for testing:
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.
Installation
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
License
See LICENSE.
Authors
See Authors.