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 09:13:43


On 8/28/2015 7:42 AM, Mathias Gaunard wrote:
> As I said, the standard library in question has different symbols in
> different namespaces, it is not just versioning.
> allocator, less, char_traits, insert_iterator are in ::std::native_std,
> and put into std through 'using', but pair is directly in ::std.
> The exact behaviour possibly depends on a variety of settings as well,
> for example the symbols might be iin ::std::native_std::version_id, so
> the actual logic to deduce which symbol is defined where is not trivial.
>
> Since this is allowed by the C++ standard, I think Boost should follow
> the safe route here, and simply have a fallback where it includes the
> right headers if it doesn't know the location of each symbol.

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. That is precisely why we have inline namespaces (with the end
goal being ABI compatibility).

> After all it's just a compile-time optimization, it's all nice and good
> if you want to have that optimization for libstdc++ and libc++, but it
> would be better to have the library at least work with other standard-
> conforming standard libraries rather than break because of some non-
> essential optimization.

+1. There is no standard conformant way of forward declaring stuff from
the standard library after all, so there should be a fallback that just
includes whatever header declares those symbols.

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