[Boost-bugs] [Boost C++ Libraries] #12158: boost::size() and friends should use an ADL barrier like boost::begin

Subject: [Boost-bugs] [Boost C++ Libraries] #12158: boost::size() and friends should use an ADL barrier like boost::begin
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-04-26 21:35:42


#12158: boost::size() and friends should use an ADL barrier like boost::begin
------------------------------------------+------------------------
 Reporter: Tavian Barnes <tavianator@…> | Owner: neilgroves
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.60.0 | Severity: Problem
 Keywords: |
------------------------------------------+------------------------
 boost::begin() and boost::end() are nicely declared in an ADL barrier
 namespace to avoid conflicts with code like this:

 {{{
 using std::begin;
 auto i = begin(c);
 }}}

 [http://isocpp.org/files/papers/n4280.pdf N4280] has been accepted into
 C++17, which adds std::size, std::empty, and std::data. But if users
 attempt to use those in the same way:

 {{{
 using std::size;
 auto s = size(c);
 }}}

 They may get an error. For example, if c is a
 std::vector<boost::shared_ptr<int>> or something, boost::size() will be
 found by ADL, and since it's no more specific than std::size, the call
 will be ambiguous.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12158>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC