Reference » Collections and iterators » MSortList » insert

Elgrint::MSortList<T>::insert(T) method

Declaration (see MSortList.h):

inline bool insert(const T& x);


Inserts x into the list, preserving the sorting (at O(lgn) time complexity).

Return type: bool


Name Type Description
x T


The new item is inserted to a proper position, so that the list remains sorted, according to the operator< for the T type. If the list already contains elements equal to x (equality is also determined by operator<), the new item is added right before the existing x items.

After the function returns, the existing iterators still point to the same elements as they did before.

The function returns true on success and false on a failure due to insufficient memory. The content of the list does not change on failure.

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.