32
Suppose I've got a function functionProxy that takes a generic parameter function and call its operator():
template< typename Function > void functionProxy( Function function ) {
function();
}
The object passed to it may be:
a functor:
struct Functor { void operator()() const { std::cout << "functor!" << std::endl; } };a function:
void function( ) { std::cout << "function!" << std::endl; }a (C++0x) lambda function:
[](){ std::cout << "lambda!" << std::endl; }
int main( )
{
functionProxy( Functor() );
functionProxy( function );
functionProxy( [](){ std::cout << "lambda!" << std::endl; } );
return 0;
}
Will the compiler be able to inline function within functionProxy in all the above cases?