Boost logo

Boost :

Subject: Re: [boost] [type_traits][general] Best practice for inline namespaces?
From: Roland Bock (rbock_at_[hidden])
Date: 2015-01-20 05:25:55


On 2015-01-18 18:10, 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?
I never really understood their benefits for versioning, but there are
other uses in header-only code of course. For instance, I like the ones
for user defined literals, see

http://en.cppreference.com/w/cpp/chrono/operator%22%22h

Users can pull in these literals into their scope at the granularity of
their choice due to nested inline namespaces. Very nice, IMHO.


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