Boost logo

Boost :

Subject: Re: [boost] [type_traits][general] Best practice for inline namespaces?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-01-18 13:07:04


On Sunday 18 January 2015 17:10:04 John Maddock wrote:
> > FWIW, I'm using inline namespaces (or emulation in C++03) in Boost.Log,
> > although I don't inject Boost version. Works quite well in detecting
> > configuration mismatch cases, when user's code is compiled in a mode
> > incompatible with the compiled library. I'm not sure how useful this would
> > be with TypeTraits though, given that the traits are compile-time
> > constructs and ABI compatibility is not an issue.
>
> I think you may have hit the nail on head there: are inline namespaces
> of any use for header-only code?

Yes, they are in general. Things like function, shared_ptr, any, variant are
often present in binary interfaces of user's code. Making these component
names versioned will make sure that user's ABI wont break if he (accidentally)
mix different versions of Boost or different configurations. But that's not
the case for libraries like TypeTraits or MPL.


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