Opened 11 years ago

Closed 9 years ago

#6715 closed Bugs (fixed)

Derived from iterator_range and operator==

Reported by: Olaf van der Spek <olafvdspek@…> Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

Shouldn't this just work? Comparing two boost::iterator_range<const char*> works fine.

#include <boost/range/iterator_range.hpp>

class str_ref : public boost::iterator_range<const char*>
{
};

int main()
{
       boost::iterator_range<const char*> a;
       a == a;
       str_ref b;
       b == b; // 12
}

is.cpp: In function ‘int main()’:
is.cpp:12:7: error: ambiguous overload for ‘operator==’ in ‘b == b’
is.cpp:12:7: note: candidates are:
is.cpp:12:7: note: operator==(boost::iterator_range<const
char*>::unspecified_bool_type {aka const char*
boost::iterator_range<const char*>::*}, boost::iterator_range<const
char*>::unspecified_bool_type {aka const char*
boost::iterator_range<const char*>::*}) <built-in>
/usr/include/boost/range/iterator_range_core.hpp:438:21: note: bool
boost::operator==(const boost::iterator_range<IteratorT>&, const
ForwardRange&) [with IteratorT = const char*, ForwardRange = str_ref]
/usr/include/boost/range/iterator_range_core.hpp:431:21: note: bool
boost::operator==(const boost::iterator_range<IteratorT>&, const
boost::iterator_range<Iterator2T>&) [with Iterator1T = const char*,
Iterator2T = const char*]
/usr/include/boost/range/iterator_range_core.hpp:387:21: note: bool
boost::operator==(const ForwardRange&, const
boost::iterator_range<IteratorT>&) [with IteratorT = const char*,
ForwardRange = str_ref]

Change History (1)

comment:1 by Neil Groves, 9 years ago

Resolution: fixed
Status: newclosed

Yes it should!

Note: See TracTickets for help on using tickets.