[Boost-bugs] [Boost C++ Libraries] #5547: boost::range::join ambiguous with boost::algorithm::join

Subject: [Boost-bugs] [Boost C++ Libraries] #5547: boost::range::join ambiguous with boost::algorithm::join
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-18 00:10:03


#5547: boost::range::join ambiguous with boost::algorithm::join
-----------------------------------+----------------------------------------
 Reporter: chris.byrne@… | Owner:
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost 1.46.1 | Severity: Problem
 Keywords: |
-----------------------------------+----------------------------------------
 = Summary =

 Calling boost::join with an iterator range when both boost algorithm and
 boost range join.jpp headers have been included, introduces an ambiguity
 with Visual Studio 2010.

 = Steps to Reproduce =

 {{{
 #include <vector>
 #include <boost/algorithm/string/join.hpp>
 #include <boost/range/join.hpp>

 int main() {
         std::vector< int > vec1;
         std::vector< int > vec2;

         boost::join(
                 vec1,
                 boost::make_iterator_range( vec2.begin(), vec2.end() )
         );

         return 0;
 }
 }}}

 = Expected Results =

 Code to compile and do nothing.

 = Actual Results =

 `main.cpp(16): error C2668: 'boost::range::join' : ambiguous call to
 overloaded function`

 `boost\range\join.hpp(65): could be 'boost::range::join`

 `boost\algorithm\string\join.hpp(46): or 'boost::algorithm::join'`

 = Notes =

 boost::algorithm::join is pulled into the boost namespace with a using
 declaration. boost::join is defined directly in the boost namespace by the
 range library meaning I can't explicitly refer to it.

 Current workaround is to move boost::join into boost::range::join, and
 then pull it into the boost namespace with a using declaration.


 {{{
 namespace range {

 join(SinglePassRange1& r1, SinglePassRange2& r2);

 } // namespace range

 using range::join;
 }}}

 Allowing the example code to be resolved by being more explicit:


 {{{
 boost::range::join(
         vec1,
         boost::make_iterator_range( vec2.begin(), vec2.end() )
 );
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5547>
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:06 UTC