[range] iterator_range operators are too greedy

Hi, iterator_range operators are defined like this: template< class IteratorT, class ForwardRange > inline bool operator==( const ForwardRange& l, const iterator_range<IteratorT>& r ) { return boost::equal( l, r ); } These needs to be restricted with enable_if on type of first argument. I have a scenario where I want to define operator== for my own type and want to be able to use it with iterator_range as second argument. Above definition makes it impossible. Gennadiy

On Thu, Nov 8, 2012 at 9:35 AM, Gennadiy Rozental <rogeeff@gmail.com> wrote:
Is this related to https://svn.boost.org/trac/boost/ticket/6715? Sadly not a single response from the Range maintainers. -- Olaf

On 8 Nov 2012 10:13, "Olaf van der Spek" <ml@vdspek.org> wrote:
On Thu, Nov 8, 2012 at 9:35 AM, Gennadiy Rozental <rogeeff@gmail.com>
wrote:
Sadly the maintainer has been extremely busy. I have acknowledged that tickets have been waiting longer than I would have liked. It is something I will address but has never appeared to be anything more than a minor inconvenience previously. In the new year I will be able to devote more time to improving Boost.Range. this will include bringing in new code submitted by others that I have been reviewing for a little while. I am listening to people and ensuring that anything major is addressed. I am also working toward a schedule that will deliver more for Boost. I am also disappointed by the amount of time that I have had available for this. The tickets for Boost.Range are not being ignored and there is a credible plan to hasten progress.
-- Olaf
Neil Groves

On Thu, Nov 8, 2012 at 12:35 AM, Gennadiy Rozental <rogeeff@gmail.com>wrote:
Is your type a range? How does its semantics differ from the operator== above? Presumably if you want to specifically address boost::iterator_range, then template< class I > inline bool operator==(my_type, iterator_range<I>); should be a preferable overload. - Jeff

Jeffrey Lee Hellrung, Jr. <jeffrey.hellrung <at> gmail.com> writes:
Is your type a range?
No.
How does its semantics differ from the operator== above?
I am building an expression template structure to delay operator== evaluation.
Unfortunately it is not. I am getting ambiguity errors. Gennadiy

On Thu, Nov 8, 2012 at 2:17 PM, Gennadiy Rozental <rogeeff@gmail.com> wrote:
Sounds like hackery :)
Works for me (MSVC9): #include <boost/range/iterator_range.hpp> struct my_type { }; template< class I > inline bool operator==(my_type, boost::iterator_range<I>) { return false; } int main(int argc, char* argv[]) { my_type x; boost::iterator_range< int* > i; x == i; return 0; } - Jeff
participants (6)
-
Gennadiy Rozental
-
Jeffrey Lee Hellrung, Jr.
-
Mathias Gaunard
-
Neil Groves
-
Olaf van der Spek
-
Thorsten Ottosen