c++ - About conversion operator and operator() -
in following code: template <class t> class mval { protected: t max; public: template <class iter> mval (iter begin, iter end):max(*begin) { while(begin != end) { (*this)(*begin); ++begin; } } void operator()(const t &t) { if (t > max) max = t; } void print() { cout << max; } }; int main() { int arr[3] = { 10,20,5 }; (mval<int>(arr, arr + 3)).print(); } why (*this)(*begin); leads operator() ? shouldn't go operator when have mval x; x(t); ? behaves it's conversion operator, how? how mval x; x(t); different (*this)(*begin); ? in both cases see object of type mval followed parentheses 1 argument inside. did expect happen? (*this) not type, it's lvalue of type mval , don't see how "behaves it's conversion operator" either.