Listing 4
#include <functional> #include <iostream> #include <math.h> using std::cout; using std::tr1::reference_wrapper; int main() { // demonstrate reference_wrapper as call wrapper reference_wrapper<float(*const)(float)> wrap(cosf); cout << "cosf(1.0) is " << cosf(1.0) << '\n'; cout << "wrap(1.0) is " << wrap(1.0) << '\n'; return 0; }