|
Boost : |
Subject: Re: [boost] review request: addition to type_traits library ofhas_operator_xxx
From: Edward Diener (eldiener_at_[hidden])
Date: 2010-11-18 00:52:56
On 11/17/2010 8:59 PM, Nevin Liber wrote:
> On 17 November 2010 16:23, Edward Diener<eldiener_at_[hidden]> wrote:
>
>> Alternatively I could even see putting all the operator traits in their own
>> namespace of 'boost::operators', dropping the 'operator_' in their name, and
>> allowing the end-user to surface them to just the 'boost' namespace via a
>> using declaration as they like. But then again, I am a very strong supporter
>> of namespaces and allowing the end-user to expose what they want from
>> namespaces via 'using'.
>>
>
> The problem, of course, is when you need them in a header, where using
> declarations cannot be scoped. This makes Boost.Multi-index a bit
> unwieldly, for example.
You are right about using directives but, I believe, it would always be
possible to provide a header with using declarations for
boost::operators which, when included, could bring them directly into
the boost namespace if so desired. As a simple example:
namespace XX
{
void AFunction();
}
namespace YY
{
using XX::AFunction;
}
One can now refer to YY::AFunction() from some source code. I have
'hoisted' XX::AFunction() into another namespace so to speak.
>
> I really don't mind if it gets spelled with namespaces instead of
> underscores, but a using declaration is not a motivation for it.
OK. But I prefer namespaces rather than decorating names with some
common 'prefix' to show commonality. I personally believe as an end-user
that there is the tendency to pile too much directly into the boost
namespace.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk