[Cs3] custom sort
Mikhail Nesterenko
mikhail at cs.kent.edu
Wed Jul 8 13:25:07 EDT 2015
CS3 students,
Per discussion today. The standard std::sort() uses operator< for
sorting. However, a "custom" std::sort() takes an extra parameter
which is a callback predicate that accepts two parameters. The sorting
is done on the basis of the output of this callback. I modified the
object sorting example, to sort the employees in the decreasing order
of their salaries.
http://vega.cs.kent.edu/~mikhail/classes/cs3/Examples/STL/Algorithms/obj.cpp
Thanks,
--
Mikhail
More information about the cs3
mailing list