[function] does calling boost::function from boost::function involve nested virtual calls?

Hi all, Correct me if I'm wrong, using boost::function involves a virtual function call. If so, then does nesting boost::function calls result in nested (multiple) virtual function calls? For example: int foo(float); boost::function<int (float)> f1 = foo; boost::function<double (int)> f2 = f1; Does f2(5) result in two virtual functions being called on the part of boost::function? (I couldn't find the answer in the documentation and reading the source code I got lost in the macros.) Thanks, Mostafa

AMDG On 11/6/2010 9:02 PM, Mostafa wrote:
Hi all,
Correct me if I'm wrong, using boost::function involves a virtual function call.
Not exactly, but close enough for practical purposes.
If so, then does nesting boost::function calls result in nested (multiple) virtual function calls?
Yes.
For example:
int foo(float);
boost::function<int (float)> f1 = foo; boost::function<double (int)> f2 = f1;
Does f2(5) result in two virtual functions being called on the part of boost::function?
(I couldn't find the answer in the documentation and reading the source code I got lost in the macros.)
In Christ, Steven Watanabe
participants (2)
-
Mostafa
-
Steven Watanabe