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
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.