Boost logo

Boost :

Subject: Re: [boost] Feature macro for putting things in the std namespace
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2015-08-28 10:10:46


On 8/28/2015 10:50 AM, Mathias Gaunard wrote:
> Agustín K-ballo Bergé <kaballo86 <at> hotmail.com> writes:
>
>> If by "this" you mean defining stuff elsewhere and importing into
>> namespace `std` via `using` then no, that is not allowed by the C++
>> standard.
>
> Where do you see this?

Have a look at N1344, Namespaces and Library Versioning, where it
explains that using `using` it's not an option; and at N2535, Namespace
Association ("inline namespace"), where inline namespaces are proposed
as a viable option to solve the issues raised in N1344.

> A lot of stuff from both libc++ and libstdc++ are also defined like this.

I'd be interested in knowing which symbols are part of that lot of
stuff, when those fall out of the special rules for standard library
symbols.

> All cXXX headers define their symbols in the global namespace, then put
> them into ::std with a using.

cXXX headers are not guaranteed nor required to define their symbols in
the global namespace. Special wording allows those specific headers to
be implemented by #including the corresponding XXX.h, which does define
those symbols in the global namespace (since it's a C header), and later
bring them into `std` via `using`. Refer to 17.6.1.2 [headers]/4 for the
wording bits.

Regards,

-- 
Agustín K-ballo Bergé.-
http://talesofcpp.fusionfenix.com

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