Subject: Re: [boost] Does boost help in creating generic function wrappers?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-07-15 14:27:23
Andy Venikov wrote:
> Steven Watanabe wrote:
>> Just define your wrapper to take references, and wrap it in
>> This should have exactly the same effect as defining all the overloads
> 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.