Boost logo

Boost :

Subject: Re: [boost] [type_traits][general] Best practice for inline namespaces?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2015-01-18 10:36:33


Le 18/01/15 13:16, John Maddock a écrit :
> 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'm not for associating the version of Boost to the one of the library.
Using inline namespaces in order to versioning has a sense only when you
cannot be backward compatible. I would use only the major version.

namespace boost {
inline namespace type_traits {

#if BOOST_TYPE_TRAIT_MAJOR_VERSION=1
inline namespace v1 {
     ....
}
#elif BOOST_TYPE_TRAIT_MAJOR_VERSION=2
inline namespace v2 {
     ...
}
}
}

I suppose that you know that inline namespaces emulation via using
doesn't support template class specialization, as the user must do the
specializations on the original namespace. :(

Best,
Vicente


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