Usage
The sort
function is included from the algorithm
header of the C++ Standard Library, and carries three arguments: RandomAccessIterator first, RandomAccessIterator last, Compare comp
. The third argument has default value - the "less-than" (<) operator to compare elements.
This code sample sorts a given array of integers (in ascending order) and prints it out. Pointers into the array serve as iterators.
#includeThe same functionality using vector container:
#includeRead more about this topic: Sort (C++)
Famous quotes containing the word usage:
“Pythagoras, Locke, Socratesbut pages
Might be filled up, as vainly as before,
With the sad usage of all sorts of sages,
Who in his life-time, each was deemed a bore!
The loftiest minds outrun their tardy ages.”
—George Gordon Noel Byron (17881824)
“I am using it [the word perceive] here in such a way that to say of an object that it is perceived does not entail saying that it exists in any sense at all. And this is a perfectly correct and familiar usage of the word.”
—A.J. (Alfred Jules)
“Girls who put out are tramps. Girls who dont are ladies. This is, however, a rather archaic usage of the word. Should one of you boys happen upon a girl who doesnt put out, do not jump to the conclusion that you have found a lady. What you have probably found is a lesbian.”
—Fran Lebowitz (b. 1951)