Boost logo

Boost :

From: troy d. straszheim (troy_at_[hidden])
Date: 2004-12-01 09:40:27


Hi boost,

The filter_iterator as implemented disallows creating iterators via
reference-to-base, as it requires its Predicate objects to be
copy-constructible. This is a problem for a class that is passed a
ref to a predicate from elsewhere. It's a very easy fix, though, I'm
wondering what the rationale originally was for the restriction. If
it isn't significant, I'd propose the change below, as (at least from
my narrow perspective) it is a big plus to be able to do this.

56c56
< filter_iterator(Predicate& f, Iterator x, Iterator end = Iterator())

---
>       filter_iterator(Predicate f, Iterator x, Iterator end = Iterator())
82c82
<     const Predicate& predicate() const { return m_predicate; }
---
>       Predicate predicate() const { return m_predicate; }
106c106
<     Predicate& m_predicate;
---
>       Predicate m_predicate;
112c112
<   make_filter_iterator(Predicate& f, Iterator x, Iterator end = Iterator())
---
>   make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator())
Thanks for your time,
-t

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