Boost logo

Boost :

Subject: Re: [boost] [Config] Multiple versions of Boost
From: Sohail Somani (sohail_at_[hidden])
Date: 2008-09-12 21:56:40


Steven Watanabe wrote:
> AMDG
>
> Sohail Somani wrote:
>> Sohail Somani wrote:
>> [snip]
>>
>>> What if Boost.Config did something like:
>>>
>>> #if !defined(BOOST)
>>> # define BOOST boost
>>> #endif
>>>
>>> And we replace all uses of the boost namespace with BOOST?
>>>
>>> Would such a patch against trunk be acceptable? What are the problems?
>
> In order to make this work we need to make sure that
> there is a namespace alias where appropriate:
>
> #if !defined(BOOST_NAMESPACE)
> #define BOOST_NAMESPACE boost
> #endif
>
> #define BOOST_NAMESPACE_boost 0
>
> #if BOOST_PP_CAT(BOOST_NAMESPACE_, BOOST_NAMESPACE)
> namespace BOOST_NAMESPACE {}
> namespace boost = BOOST_NAMESPACE;
> #endif
>
> #undef BOOST_NAMESPACE_boost

Indeed, you are right. Clever too :-)

There is one obvious problem I see with the -DBOOST_NAMESPACE=foo
approach: there is no way to include two versions of Boost within the
same translation unit. Unfortunately, I don't think there would be any
acceptable way to do this. Though I'm sure you will come back with a way
to do it!

By the way, I've received a message on IRC telling me that Xalan and
Xerces do something very similar so it wouldn't be totally unprecedented.

-- 
Sohail Somani
http://uint32t.blogspot.com

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