|
Boost Users : |
Subject: Re: [Boost-users] [Bind] How to create a functor which returns one ofits arguments?
From: Andrew Maclean (andrew.amaclean_at_[hidden])
Date: 2009-12-08 20:16:36
Why would you do this?
(I mean the standard unary functor).
Thanks
Andrew
On Wed, Dec 9, 2009 at 11:10 AM, Peter Dimov <pdimov_at_[hidden]> wrote:
> Vadim Guchenko wrote:
>>
>> Hello, All!
>>
>> Is there a simple way to create a functor that returns one of its
>> arguments _1, _2, ...?
>> Does standard unary functor exist, which simply returns its argument
>> unchanged? I.e.:
>>
>> template<typename T>
>> struct arg: public std::unary_function<T, T> {
>> T operator()(const T &x) const { return x; }
>> };
>
> It's not part of the current standard, but many implementations provide
> std::identity as an extension. (It will be standard in C++0x.)
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
-- ___________________________________________ Andrew J. P. Maclean Centre for Autonomous Systems The Rose Street Building J04 The University of Sydney 2006 NSW AUSTRALIA Ph: +61 2 9351 3283 Fax: +61 2 9351 7474 URL: http://www.acfr.usyd.edu.au/ ___________________________________________
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