10 9 times.
A:
struct X {
virtual ~X() {}
virtual void do_x() {};
};
struct Y : public X {};
int main () {
Y* x = new Y;
for (int i = 100000000; i >= 0; -- i)
x->do_x();
delete x;
return 0;
}
B: ( 1.41):
#include <boost/function.hpp>
struct X {
void do_x() {};
};
int main () {
X* x = new X;
boost::function<void (X*)> f;
f = &X::do_x;
for (int i = 100000000; i >= 0; -- i)
f(x);
delete x;
return 0;
}
g++ -O3, time,
, , , f NULL. , boost::function, 2,4 ( 2 ), do_x() . , boost::function.