Opened 11 years ago

Closed 11 years ago

#5547 closed Bugs (fixed)

boost::range::join ambiguous with boost::algorithm::join

Reported by: chris.byrne@… Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.46.1 Severity: Problem
Keywords: Cc:

Description

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() )
);

Change History (2)

comment:1 by anonymous, 11 years ago

Component: Nonerange
Owner: set to Neil Groves

forgot to set component to boost range

comment:2 by Neil Groves, 11 years ago

Resolution: fixed
Status: newclosed

Thank you for your report. This is now resolved on the trunk.

Note: See TracTickets for help on using tickets.