why std::less<int>() is a function object

c++, stl

Solution

`std::less<int>()` is a constructor call. It creates a new `std::less<int>` object which, yes, has overloaded `operator()`.

Problem

why is `std::less<int>()` a function object as used in ``` std::sort(vec.begin(),vec.end(),std::less<int>()); ``` but `std::less<int>` is a type and operator is function call, there is no object been created, or memory address we can reference

Original source

Related problems