Boost logo

Boost Users :

Subject: Re: [Boost-users] [Bind] How to create a functor which returns one of its arguments?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-12-08 18:56:40


On Tue, Dec 8, 2009 at 8:26 AM, Roman Perepelitsa
<roman.perepelitsa_at_[hidden]> wrote:
> 2009/12/8 Vadim Guchenko <nomail_at_[hidden]>
>>
>> Hello, All!
>>
>> Is there a simple way to create a functor that returns one of its
>> arguments
>> _1, _2, ...?
>
> In Boost.Lambda _2 is a functor that returns its second argument and
> constant(true) is a functor that always returns true. The same works with
> Boost.Phoenix.

What you are wanting is to return an argument, lazily. Boost.Bind is
not built for that. Both Boost.Lambda and Boost.Phoenix are done
lazily, and both do everything that Boost.Bind does, and Boost.Phoenix
does everything that Boost.Lambda does.


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