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 09:40:58


On Sunday 18 January 2015 12:16:37 John Maddock wrote:
> I was thinking of adding inline namespace support (ie lib versioning) to
> type_traits, but what's the best practice for naming the inline
> namespace? I was thinking of going with some mangled version of
> BOOST_VERSION which would effectively change the namespace with each
> release. That feels like it's probably right to me: old versions of any
> traits would then be archived in boost::tt105600:: or whatever version
> the change happened. Comments?

I think the major point for keeping the old TypeTraits is backward
compatibility, i.e. user's code should not require modification. So I think
it's better to keep the old implementation as is and use a new namespace for
the new one.

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.


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