Boost logo

Boost :

Subject: Re: [boost] version conflicts: is there a solution?
From: Christian Schladetsch (christian.schladetsch_at_[hidden])
Date: 2009-06-24 00:22:50

I've done this before, the general pattern I've used is


#define FOO_BEGIN namespace FOO_NAMESPACE_NAME {
#define FOO_END }

Of course, it would be quite a chore to trawl through all of boost to make
this sort of scheme work. However, version numbers could also be
concatenated automatically as required.

On Wed, Jun 24, 2009 at 12:49 PM, Lewis Hyatt <lhyatt_at_[hidden]> wrote:

> Hi Everyone-
> This has been discussed before
> (, but I think
> my
> question is along a slightly different line so I thought I would ask about
> it.
> Let's say I want to compile and distribute a library (without the source),
> and I
> happen to use some boost header-only libraries as an implementation detail
> in
> some of my functions. None of the headers associated with my library
> include
> boost headers; it's purely an internal detail.
> Now, it seems to me that users of my library will still have to be aware of
> the
> fact that I used boost in my implementation -- specifically, if they happen
> to
> use different versions of the same boost libraries in their code, then the
> is violated and the behavior is undefined.
> I realize this isn't a boost-specific problem (it would affect any library
> of
> template functions), but I am wondering if there is a boost-specific
> solution
> already worked out? Has anyone thought about this? It seems to me that in
> this
> case, what would be ideal would be if I could do:
> #define BOOST_NAMESPACE some_unique_namespace_for_boost
> #include "boost/algorithm/string.hpp"
> BOOST_NAMESPACE::shared_ptr<void> x; //or whatever
> Then I can insure there are no ODR violations and I don't need to bother
> users
> of my library with the fact that I used boost at all.
> Other than the sheer annoyance of having to go through all the boost code
> to use
> this macro, is there a strong downside to this approach?
> Alternatively, I could try:
> namespace {
> #include "boost/..."
> }
> But I don't know, could this work? Or are there boost headers that rely on
> fully
> qualified references like ::boost::algorithm::whatever?
> I'd appreciate anyone's thoughts on this issue, thanks!
> -Lewis
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at