|
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++
no_op
is the (nullary) do-nothing function object, and thus
ignore(ignore(no_op))
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++:
ignore(ignore(const_(true)))
or
lambda(X,Y)[ true ]
-- -Brian McNamara (lorgon_at_[hidden])
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk