Boost logo

Boost Users :

From: Witz (witz_at_[hidden])
Date: 2004-04-15 03:30:28


> > if it was possible it would allow us to write, for example:
> >
> > copy( make_filter_iterator<is_positive_number>(numbers, numbers + N),
> > numbers + N, ostream_iterator<int>(cout, " "));
> >
> > rather than:
> >
> > copy( make_filter_iterator<is_positive_number>(numbers, numbers + N),
> > make_filter_iterator<is_positive_number>(numbers + N, numbers + N),
> > ostream_iterator<int>(cout, " "));
> >
> > of course i am aware that i might be missing something obvious ...
>
> I think you are. the signature of std::copy is:
>
> template<class InputIterator, class OutputIterator>
> OutputIterator copy(
> InputIterator first, InputIterator last, OutputIterator result);
>
> What will the compiler deduce InputIterator to be?
>

you are right of course - which is a shame.

for my own use, however, i would happily rewrite the stl algorithms to allow
for this usage. i often find i have issues with that area of the standard
library in any case: why does binary_search not return an iterator to the
item i'm searching for? why min_element, max_element when best_element,
worst_element is less confusing? why no copy_if? etc. of course that could
just be me :)

ian whittley


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net