Re: [Boost-bugs] [Boost C++ Libraries] #8011: iterator_range::size() is not SFINAE-friendly

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8011: iterator_range::size() is not SFINAE-friendly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-18 09:32:19


#8011: iterator_range::size() is not SFINAE-friendly
---------------------------------------------------------+------------------
  Reporter: Jonathan Wakely <jwakely.boost@…> | Owner: neilgroves
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: range
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------------------------+------------------

Comment (by jwakely.boost@…):

> Feel free to weigh in.

 I'd rather not, the boost lists are an enormous time sink. The only reply
 is typical: offering advice without bothering to read the ticket you
 linked to, which provides the use case. The reason iterator_range::size()
 doesn't use std::distance() is to guarantee it's O(1). The same reason
 std::forward_list doesn't provide size() (but it *doesn't provide* it,
 rather than providing it and failing a static assertion.)

> So you can just always use std::distance.

 Solving the problem for RA iterators was never the issue, obviously
 std::distance works for them, but that's sub-optimal for non-RA iterators.
 If a container such as std::map, which has bidirectional iterators,
 provides an O(1) size() member then I want to use it. But I can't tell
 whether a range provides size() or not, because iterator_range provides it
 but it isn't usable.

 I'm currently tempted just to say my type doesn't support
 boost::iterator_range and be done with it.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8011#comment:11>
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:12 UTC