Comparetor function

to make minheap i make priority_queue<int,vetor,greater >but if have to sort any container in reverse order i call sort(begin_add,end_add, greater() >
why??
greater -> greater() //difference

Basically , it is implemented in Standard Template Library in this way for the easiness of user.
As In priority queue, it is implemented as class having operator overloading .

1 Like