struct absInt
{
int operator() (int val)
{
return val < 0 ? -val : val;
}
};
class Funclass
{
public:
Funclass(){};
bool operator()(CStr& mcstr)
{
std::cout<<mcstr.getStr()<<endl;
return true;
}
};
int i = -42;
absInt absObj; // object that defines function call operator
unsigned int ui = absObj(i); // calls absInt::operator(int)
class GT_cls {
public:
GT_cls(size_t val = 0): bound(val) { }
bool operator()(const string &s)
{ return s.size() >= bound; }
private:
std::string::size_type bound;
};