Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2007-03-20 13:35:04


Hi,

>>> 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.
>>
> That was what I was thinking. They could be templated there, but using
> boost::function as a default template arg. This would provide type
> erasure by default, but allow higher performance where needed. Since
> it's already templated on one type, it might as well be on one more, or?

Without the type erasure, the usage of iterators would get less
convenient. For example, you would not be able to compare iterators with
different finders. This is manifested when using default constructed
find iterator as end-of-search tag.

Anyway, maybe the default template argument is a way to go. I will think
about it.

> It's a minor thing though. Sorry for the noise.

No problem. Every suggestion is worth consideration.

Regards,
Pavol.


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