Boost logo

Boost :

Subject: Re: [boost] Does boost help in creating generic function wrappers?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-07-15 14:27:23


AMDG

Andy Venikov wrote:
> Steven Watanabe wrote:
>> Just define your wrapper to take references, and wrap it in
>> forward_adapter.
>> This should have exactly the same effect as defining all the overloads
>> yourself.
>
> Correct me if I'm wrong, but I think it's not going to work when the
> inner functor has (T const &) parameter. If my wrapper declares
> everything T &, then it won't be able to accept non-const rvalues
> whereas the original functor was able to do that.

If you use forward_adapter, you don't need to handle non-const rvalues.
forward_adapter handles the overloading and passes const or non-const
lvalues to your function object.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk