//Example of a function object with an operator() method. // See p586 of the Primer #include class threshold { double val; public: threshold( double v): val(v) {} bool operator()( double y){ return y < val; } } reallySmall( 1.e-8 ), small(1.e-3); int main() { double x; while ( std::cin >> x ) std::cout << x << " " << (reallySmall(x) ? "tiny" : small(x) ? "small" : "big") << '\n'; }