
15 Jul
2010
15 Jul
'10
6:27 p.m.
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