Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-11-09 17:34:33


"Robert Ramey" <ramey_at_[hidden]> wrote in message
news:cmrbom$qcv$1_at_sea.gmane.org...
|
| "John Torjo" <john.lists_at_[hidden]> wrote in message
| news:41909351.4030100_at_torjo.com...
|
| example 1
|
| > >>It makes dealing with containers/STL algorithms simpler by using ranges
| > >>(as opposed to iterators).

| Attached is the equivalent code using iterators.
|
| It includes code to add templeted constructors to iterators and to make
| functors for this particular example. Otherwise its very similar in
| functionality. And that is my point. I don't see that ranges are anything
| more than a very thin layer over iterators. Admitidly, iterators could
| perhaps use some embellishment (perhaps templated constructors) or other
| things to make them easier to use, but I don't think a whole now layer/view
| is warrented. I would prefer to see such efforts invested in making
| iterators easier to use without hidind their essential character.

If you are going to convince me iterators are easy to use, you have to come up
with something better than

    typedef amended::transform_iterator<
        get_empl_name_f,
        amended::filter_iterator<
            from_ro_f,
            std::vector<employee>::const_iterator
>
> romanian_names_t;

    std::copy(
        romanian_names_t(empls.begin()),
        romanian_names_t(empls.end()),
        std::ostream_iterator<std::string>(std::cout," ")
    );

Seriously, this is so ugly and hard to write that I predict less than 1% of
the community will ever use it.

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk