Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2003-08-29 23:09:37

On Thu, Aug 28, 2003 at 03:59:19PM +0400, Vladimir Prus wrote:
> Would it be desirabe to have such class? I'm thinking about
> struct do_nothing {
> template<class T>
> void operator()(const T&) const {}
> template<class T1, class T2>
> void operator()(const T1& t1, const T2& t2) const {}
> //....
> }

Someone has already commented WRT bind/lambda. Just FYI (as more
support that, yes, it can be generally useful), in FC++


is the (nullary) do-nothing function object, and thus


is the function you've written above. (ignore() is a combinator which
takes a function and returns a new function which takes an extra first
argument and ignores it.)

> And another question. Do we have a functional object which always returns
> true, and can be called with two arguments of any types? Again, some BGL
> header has such a class in detail namespace.

Again, I imagine you do something similar with bind/lambda; in FC++:

   lambda(X,Y)[ true ]

-Brian McNamara (lorgon_at_[hidden])

Boost list run by bdawes at, gregod at, cpdaniel at, john at