Andre Poenitz <[EMAIL PROTECTED]> writes: | On Wed, Nov 09, 2005 at 10:21:19AM +0100, Georg Baum wrote: | > class ParAddressEqual : public std::unary_function<Paragraph, bool> { | > public: | > ParAddressEqual(Paragraph const * par) : par_(par) {} | > bool operator()(Paragraph const & par) const { | > return &par == par_; | > } | > private: | > Paragraph const * par_; | > }; | > | > ParagraphList::iterator it = std::find_if(pars_.begin(), pars_.end(), | > ParAddressEqual(&par)); | > | > IMHO this is overkill if used only once, but is useful if you need it | > several times. | | Unless 'several' means 'a few dozen and more' I'd dispute 'useful'.
IMO it is useful even if used only once. - makes it _very_ clear that we are looking for something - and that the crieteria is ParAddressEqueal (even if I dislike this mixture of offsets and pointers and references and iterators...) -- Lgb