Boost logo

Boost :

Subject: Re: [boost] Any real-world need for static_cast_iterator, const_cast_iterator, dynamic_cast_iterator?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-02-04 09:41:35


Nigel Stewart wrote:
>
>> Personally, I've had much use of a custom made match<Type>() adaptor
>> (using the Boost.RangeEx pipe syntax), that performs a transform with
>> dynamic_pointer_cast and then filters null results.
>
> The idea would be to skip items that dynamic cast to NULL
> in the operator++() and operator--()? Except that I'm
> not sure how to detect the end of the container... ...
> sounds interesting...

range | match<Type>()

is just like

range | transformed(dynamic_cast_<Type>(_1)) | filtered(_1)

(assuming my lambdas are correct)


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