I have created version 3 of the cxx_dual library. version 3 is a large
rewrite of the documentation to simplify the use of the library, as well
as a change in the directory structure so that the basic usage of the
library is through a single header file and the use of a namespace
alias, and not through the macro interface. As in:
#include
void SomeFunction()
{
cxxd_regex_ns::regex re("A regular expression etc.");
bool result(cxxd_regex_ns::regex_match("Some string...",re));
// etc.
}
What ! No macros ! Actually a few macros still exist for testing which
dual library has been chosen and overriding the dual library chosen, but
the basic functionality means almost no macros in user code.
The library is available at https://github.com/eldiener/cxx_dual.git.
What is it ?
The Cxx Dual library, or CXXD for short, is a C++ macro header-only
library which chooses between using a Boost library or its C++ standard
equivalent library for a number of different C++ implementations, while
allowing the end-user to use the same code to program either choice. An
implementation is a Boost library which has a C++ standard library
equivalent whose public interfaces are nearly the same in both cases. An
'implementation' is called a 'mod' for short and each of the possible
Boost or C++ standard implementations for that mod are called a 'dual
library'.
The Cxx Dual library does this by automatically choosing either the
Boost library or the C++ standard library for a particular mod,
including the correct header file(s) needed for the dual library chosen,
and creating a namespace alias for the namespace of the dual library
chosen. CXXD also provides a macro-based solution for distinguishing
between the Boost version and the C++ standard version of a dual library
so that specific code for a particular dual library choice may be
written in those cases where the public interfaces diverge.