Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5142 closed Bugs (invalid)

type_erased feels unnecessary.

Reported by: Akira Takahashi <faithandbrave@…> Owned by: neilgroves
Milestone: To Be Determined Component: range
Version: Boost Release Branch Severity: Problem
Keywords: Cc:

Description

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.

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by Akira Takahashi <faithandbrave@…>

<del>Even if there is few it, I feel that I am premature to include it in 1.46.0 official release.</del> At least, I feel that it is too early to include type_erased into 1.46.

comment:2 Changed 6 years ago by neilgroves

  • Resolution set to invalid
  • Status changed from new to closed

I didn't feel it was too early to put this into the release branch. The core of the interface design is built upon experience gained with other any_iterator implementations. The implementation of any_interface has been tested in production environments successfully. The inclusion of the type_erased definitely has application particularly when chaining adaptors that are passing results to templatised range algorithms that are not specialised for any_range.

At this point experience shows that the feature is popular and working.

comment:3 Changed 6 years ago by faithandbrave@…

The core of the interface design is built upon experience gained with other any_iterator implementations.

I cannot find the experience. Where can it be seen? At least, with the sample on a document, I do not think that it is useful.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain neilgroves.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.