Boost logo

Boost :

Subject: [boost] Cxx dual library
From: Edward Diener (eldiener_at_[hidden])
Date: 2016-06-02 14:55:27


I have finished all the main work on the Cxx dual library at
https://github.com/eldiener/cxx_dual. The library is also in the Boost
Library Incubator at
http://rrsd.com/blincubator.com/bi_library/cxx_dual-2/?gform_post_id=1597.

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
using 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 'dual library' in this documentation, or 'CXXD-mod' for short.

The library does this by defining object-like macros for including the
appropriate header file and namespace or using either the Boost library
version or the C++ standard library version of a particular dual
library. CXXD currently supports twenty eight different dual libraries,
where the Boost version and the C++ standard version is nearly
interchangeable in some respects. 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.

The library came out of my initial PR to add such a feature to
Boost.Config, and then I decided to create a separate library and expand
on the functionality. The gist of the library is to write a single set
of code for a particular implementation and have it work whether or not
that code targets a Boost implementation or its C++ standard equivalent.
The default algorithm will choose the C++ standard implementation if it
is available, otherwise it chooses the Boost implementation. The default
can be overriden for any of the 28 different implementations which CXXD
supports.

With all the talk about supporting C++11 or C++14 in new code, the
library offers a way of supporting C++11 or C++14 standard libraries if
available whether one writes in C++03 dialect or uses the new language
features of C++11 on up. The Cxx dual library itself, being macro based,
should work with any C++ code at that code's language level. The library
itself is NOT, repeat NOT, an attempt to enforce a C++ language level
for anybody who wants to use it.

I have a little more work I am doing on increasing the support for Boost
Build in the library, but all the central implementation of the library
is complete in my mind.

Questions, comments, or bug reports are always welcome, either here in
this mailing list, in the Boost Library Incubator, or as Github issues,
by those who are interested in trying the library out or reading the
documentation.

I will be using CXXD in another library on which I am working but
hopefully others will find a use for it in their own code.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk