Reference » Collections and iterators » MVector » sort

Elgrint::MVector<T>::sort() method

Declaration (see MVector.h):

bool sort();

Description

Sorts all the elements in the vector in ascending order, according to operator< of type T.

Return type: bool

Details

To use this function, T must define a binary operator<, otherwise the program will not compile. The function uses the Quick-Sort algorithm to sort all the elements. The sorting order is defined by the operator< for type T.

The function returns true on success, and false on failure due to insufficient memory.

On success, all iterators owned by this vector are disowned automatically, because the sorting messes up the order of elements beyond recognition. On failure, the vector does not change.

Let us know

Please Contact us to report any errors on this page, or to suggest any improvements.

Miranor Home | About Miranor | About Elgrint | Create account | Login | Account settings | Contact Us | Privacy Policy | Site map

© Copyright 2014 by Miranor. All rights reserved. By using this site you agree to the Terms of Use.

Page last updated on August 10th, 2014.