Re: [Boost-bugs] [Boost C++ Libraries] #7630: Range adaptors do not play nicely with range-based for loops

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7630: Range adaptors do not play nicely with range-based for loops
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-20 03:19:27


#7630: Range adaptors do not play nicely with range-based for loops
--------------------------------+-------------------------------------------
  Reporter: gromer@… | Owner: neilgroves
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: range
   Version: Boost 1.51.0 | Severity: Problem
Resolution: | Keywords: range
--------------------------------+-------------------------------------------

Comment (by Jeffrey Yasskin <jyasskin@…>):

 Replying to [comment:2 roman.perepelitsa@…]:
> There is one problem with the proposed solution: return types for all
 range adaptors are documented.

 Even though the adaptor return types are documented, they're not accurate.
 For example,
 http://www.boost.org/doc/libs/1_53_0/libs/range/doc/html/range/reference/adaptors/reference/filtered.html
 says it returns a "boost::filtered_range<typeof(rng)>" (what is "typeof"?
 :-P), but it actually returns filtered_range<Pred, Rng>.
 adjacent_filtered, filtered, copied, replaced_if, and transformed list the
 wrong return types. indexed, indirected, map_keys, map_values, replaced,
 reversed, sliced, type_erased, and uniqued list the right ones. strided
 and tokenized don't list a return type.

 The natural return type for the fixed adapters is to have, say,
 lvalue|reversed return a reversed_range<Rng&> and rvalue|reversed return a
 reversed_range<Rng>, since that's what the natural function template
 deduction will produce. I could instead have lvalue|reversed return
 reversed_range<Rng> and rvalue|reversed return reversed_range<Rng&&> in
 order to maintain compatibility for the safe existing uses of these type
 names.

 I would prefer to use the natural types because then any utilities will be
 useful for non-Boost consumers.

 Thoughts?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7630#comment:6>
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:13 UTC