Boost logo

Boost :

Subject: Re: [boost] Cxx dual library
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2016-06-02 17:40:58


Le 02/06/2016 à 20:55, Edward Diener a écrit :
> 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.
Hi,

Thanks for working on this.

I have some questions.

* Do you take in account template class specialization? if yes, could
you point me where in the documentation is described how? is there an
example? If not, would you mind to add some additional helper macros to
make this possible without been able to do conditional compilation?

* IIUC, the interface of the library is either one of the dual
libraries, that is besides the macros, the the dual library doesn't
document a specific interface, so the user must know both interfaces and
its differences, isn't it?

* Have you considered adding a new namespace and import the definitions
from either boost or the standard library, so that the use of macros
will be reduced and adding some non intrusive adaptation would be
possible? I have addressed this problem from a different perspective
(See
https://github.com/boostorg/thread/tree/develop/include/boost/thread/csbl).
What do you think of this approach?

Best,
Vicente


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