
on Wed Apr 30 2008, "Daniel Walker" <daniel.j.walker-AT-gmail.com> wrote:
Aha! That just made me realize that I didn't fully understand what Dave was getting at yesterday. call() uses call-by-reference, and since boost::result_of<> treats all references as function references, you have to somehow decompose the reference before hand to determine what to pass to result_of<> so that it will do the right thing. OK. Then the snippet I sent yesterday will work for function references but not references to function objects. Still, I think the best thing to do in this case is to make call() accept only first-class function objects by value...
You're basically solving the problem by declaring it illegal. This issue comes up because I *want* to handle all callable types, and I expect to be able to use result_of to do it.
especially since all the tools needed to treat built-in functions or references to function objects as values will be available in C++0x as soon as you #include <functional>.
Please, don't speak to me of what's coming in 0x, at least not in the context of result_of. Presumably everything is warm, light, and golden in that mystical year of the future, and we won't need result_of. ;-) -- Dave Abrahams Boost Consulting http://boost-consulting.com