Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2007-03-20 11:50:31


Hi,

Marcus Lindblom wrote:
> Hi,
>
> I started using the filter/split-iterators from the string-algorithm.
> today, and liked them a lot. However, I think some improvements would
> make them even better:

I assume, you mean find/split iterators.

> 1. Provide const overloads for make_foo_iterator funcs. Currently, I
> can't use those functions to search f.ex. a const std::string. Works
> fine when using the constructor directly though.
>

The make_foo_iterator functions can handle both const and non-const
sequences. The resulting type depends on the constness of the input.
So no special const overload is necessary.

> 2. Make the filter_type public or templated (with boost::function as
> default). Simply because I'd like to avoid dynamic memory allocation
> when in functions creating those iterators. It feels a bit unnecessary
> and I can't create something of filter_iterator_base::finder_type, since
> it's protected.
>

I'm not really sure what you are trying to achieve. boost::function is
used to to handle the type erasure. As far as I know, it is not possible
to do this without some dynamic allocation and virtualization.
Without the type erasure, the find_iterators would have to be templated
by the finder type.

Regards,
Pavol.


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