Boost logo

Boost :

Subject: Re: [boost] [build] How to build a multi version non-header-library
From: Bruno Santos (bsantos_at_[hidden])
Date: 2012-01-18 06:25:59


The best approach is to use versioned namespaces, like boost::filesystem uses. If I'm not mistaken, inline namespace where introduced in C++11for this purpose.

namespace boost { namespace thread_v1 {
        ...
} }

namespace boost { namespace thread_v2 {
        ...
} }

namespace boost {
#if BOOST_THREAD_VERSION == 2
        using thread_v2::thread;
        …
#else
        using thread_v1::thread;
        ...
#endif
}

The downside is that we don't have inline namespaces in C++03, which leaves a daunting task of putting all those "using xxx;" directives.

Regards

On 18/01/2012, at 00:00, Vicente J. Botet Escriba wrote:

> Hi,
>
> I want to provide two versions for Boost.Thread, one using Boost.Chrono and the other not. Boost.Thread is a non-header-only library so I guess that I need to build two libraries with different names. Is there already a library in Boost in the same context on which I can base my build design? What is the simples way to do this with Boost.build? Any pointers to the doc?
>
> Thanks in advance,
> Vicente
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost




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