[Boost-bugs] [Boost C++ Libraries] #5142: type_erased feels unnecessary.

Subject: [Boost-bugs] [Boost C++ Libraries] #5142: type_erased feels unnecessary.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-01-31 08:24:26


#5142: type_erased feels unnecessary.
-------------------------------------------------------+--------------------
 Reporter: Akira Takahashi <faithandbrave@…> | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost Release Branch | Severity: Problem
 Keywords: |
-------------------------------------------------------+--------------------
 type_erased Range Adaptor is in release brunch of Boost 1.46.0, but I feel
 that this is unnecessary.
 It is enough if there is any_range:
 {{{
 #include <iostream>
 #include <vector>
 #include <boost/assign/list_of.hpp>
 #include <boost/range/any_range.hpp>
 #include <boost/range/algorithm/for_each.hpp>
 #include <boost/range/adaptor/filtered.hpp>

 typedef boost::any_range<
     int
   , boost::forward_traversal_tag
   , int
   , std::ptrdiff_t
> integer_range;

 void disp(int x)
 {
     std::cout << x << std::endl;
 }

 void disp_all(integer_range r)
 {
     boost::for_each(r, disp);
 }

 bool is_even(int x)
 {
     return x % 2 == 0;
 }

 int main()
 {
     const std::vector<int> v = boost::assign::list_of(1)(2)(3)(4)(5);

     disp_all(v | boost::adaptors::filtered(is_even));
 }
 }}}
 Even if there is few it, I feel that I am premature to include it in
 1.46.0 official release.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5142>
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:05 UTC