Modify

Ticket #4051 (closed Bugs: fixed)

Opened 4 years ago

Last modified 2 years ago

[range][string_algo] Conflict between algorithm names

Reported by: jewillco Owned by: marshall
Milestone: Boost 1.43.0 Component: algorithm
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

When I try to include both Boost.Range algorithms (in the current trunk version) and Boost.Algorithm, using a file such as the following:

#include <boost/algorithm/string.hpp>
#include <boost/range/algorithm.hpp>

I receive several errors about duplicate definitions. I am using gcc 4.1.2 on Linux.

./boost/range/algorithm/find.hpp:28: error: ‘template<class SinglePassRange, class Value> typename boost::range_iterator::type boost::find(SinglePassRange&, const Value&)’ conflicts with previous using declaration ‘template<class RangeT, class FinderT> boost::iterator_range<typename boost::range_iterator<C>::type> boost::algorithm::find(RangeT&, const FinderT&)’
./boost/range/algorithm/lexicographical_compare.hpp:28: error: ‘template<class SinglePassRange1, class SinglePassRange2> bool boost::lexicographical_compare(const SinglePassRange1&, const SinglePassRange2&)’ conflicts with previous using declaration ‘template<class Range1T, class Range2T> bool boost::algorithm::lexicographical_compare(const Range1T&, const Range2T&)’
./boost/range/algorithm/lexicographical_compare.hpp:42: error: ‘template<class SinglePassRange1, class SinglePassRange2, class BinaryPredicate> bool boost::lexicographical_compare(const SinglePassRange1&, const SinglePassRange2&, BinaryPredicate)’ conflicts with previous using declaration ‘template<class Range1T, class Range2T, class PredicateT> bool boost::algorithm::lexicographical_compare(const Range1T&, const Range2T&, PredicateT)’

The using declarations mentioned in the error message are in files such as boost/algorithm/string/find.hpp.

Attachments

Change History

comment:1 Changed 4 years ago by jewillco

  • Owner changed from nesotto to pavol_droba
  • Component changed from range to string_algo

comment:2 Changed 4 years ago by neilgroves

I have altered Boost.Range to implement the range algorithms in the namespace boost::range. These are then brought into the boost namespace with a using statement. For some algorithms this should mean that the overloads can be resolved, but in the cases that the functions are ambiguous the user can easily add algorithm:: or range:: to disambiguate.

comment:3 Changed 2 years ago by marshall

  • Owner changed from pavol_droba to marshall
  • Component changed from string_algo to algorithm

comment:4 Changed 2 years ago by marshall

  • Status changed from new to closed
  • Resolution set to fixed

Just tried this with the latest release branch (coming up to 1.49), and I don't get any errors:

#include <boost/algorithm/string.hpp>
#include <boost/range/algorithm.hpp>

int main (int argc, const char * argv[]) {
	return 0;
	}

Closing this ticket. If you have more information/problems, please re-open.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.