LibStdCompat is a set of compatibility headers for C++ 14, 17, and 20 for C++11. It aims to be lighter weight and more narrowly tailored than some other alternatives such as Boost or replacing your standard library with libcxx when certain fewer features are needed.
LibStdCompat is not complete -- that is it does not implement all C++14, 17, or 20 library features. But overtime, more and more of the library will be implemented.
Simply compile and link to std_compat
Generally headers have the same name as their standard library equivalent with a .h
appended. I.E. <memory>
becomes <memory.h>
, and the structure is put into the compat::
namespace so std::make_unique
becomes compat::make_unique
.
LibStdCompat depends on:
cmake
version3.13
or later (3.14 required for python bindings)pkg-config
version1.6.3
or later- either:
gcc-4.8.5
or laterclang-7.0.0
or later using eitherlibc++
orlibstdc++
. Beware that system libraries may need to be recompiled withlibc++
if usinglibc++
LibStdCompat optionally depends on:
Boost
for the implementations ofstd::optional
andstd::variant
when C++17 is not available
git clone https://github.com/robertu94/spack_packages robertu94_packages
spack repo add robertu94_packages
spack install libstdcompat
LibStdCompat uses cmake to configure build options. See CMake documentation to see how to configure options
CMAKE_INSTALL_PREFIX
- install the library to a local directory prefixBUILD_DOCS
- build the project documentationBUILD_TESTING
- build the test cases
To build and tests and install the library only.
BUILD_DIR=build
mkdir $BUILD_DIR
cd $BUILD_DIR
cmake ..
make
make test
make install
To build the documentation:
BUILD_DIR=build
mkdir $BUILD_DIR
cd $BUILD_DIR
cmake .. -DBUILD_DOCS=ON
make docs
# the html docs can be found in $BUILD_DIR/html/index.html
# the man pages can be found in $BUILD_DIR/man/