vendredi 12 juillet 2019

Functors vs comparators

I know that a functor is a function object, an overloading of () operator in a structure definition. Also the use of a functor in an algorithm seems pretty straight forward, just call this routine.

However I am not able to get a sense of comparators. Why are they used in the first place in a template argument.

Can someone please elaborate the difference between the two with a possible implementation of a template in STL like map

Aucun commentaire:

Enregistrer un commentaire