|
Boost Users : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-04-12 12:58:43
AMDG
Jean-Pierre Bergamin wrote:
> Hello everyone
>
> Imagine a class "numbers" that contains some values and methods like
> getEvenValues(), getOddValues(), getValuesLarger100() etc. Those methods
> return an iterator range of filter_iterators. In the the code I posted
> below, I'd have to define a different iterator_range of filter_iterator
> types for all the different methods (numbers::EvenFilterRange,
> numbers::OddFilterRange etc.). Is there some way to "hide" the type of
> the predicate used in a filter_iterator, so that it would be possible to
> have a generic "NumberRange" type for the return values of all methods?
> Something like:
>
> class numbers {
> typedef NumberRange ????;
> NumberRange getEvenValues() const;
> NumberRange getOddValues() const;
> NumberRange getValuesLarger100() const;
> }
>
Try using boost::function<bool(int)> for the predicate type.
In Christ,
Steven Watanabe
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