Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-11-10 04:38:20


>
>>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," ")
>> );
>>
>
>

The problem with iterators, even in Robert's example, is that to further
compose them, you need to create wrapper functors (get_empl_name_f,
from_ro_f).

Again, as I've said in the docs, anything that can be done with function
adaptors can be done with iterators. But the results will be more
error-prone, harder to write and read.

Best,
John

-- 
John Torjo,    Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.5 - tooltips at your fingertips (work for menus too!)
    + bitmap buttons (work for MessageBox too!)
    + tab dialogs, hyper links, lite html

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