|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-09-02 12:38:38
Stephen Gross wrote:
> Is there a way to use bind and/or lambda to create a functor that:
>
> (1) Takes as input a single argument (that is ignored), and
> (2) Returns a constant value.
>
> Ideally, something along the lines of:
>
> bind(constant(5), _1) // _1 is passed but ignored.
Using boost::bind:
boost::bind( identity<int>(), 5 )
where identity returns its argument.
Using lambda:
(_1, 5)
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