Boost logo

Boost :

Subject: Re: [boost] Cxx dual library
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2016-06-03 11:17:51


Am 02.06.2016 8:56 nachm. schrieb "Edward Diener" <eldiener_at_[hidden]>:
>
> 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.

Personally, I'm not a big fan of such a solution, especially when those
macros "leak" into the public interface. We had a similar interface which
would automatically switch between std and boost function. The result
looked nice at first sight, however the subtle differences between the two
led to various problems, one of which was that documenting the public
interfaces containing this macro was very difficult, where does it point to
know? Where should we send users to who look for more information about
this function type? Should they be aware of both? Switching compilers or
even boost version and now suddenly everything seems broken?
The solution for us was to just decide which one to use and go with it,
setting the requirements to the used standard library/boost version as
needed.


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