Website Summary Files Commits Branches @commit @diff @stats
path: root / src / OrderedList / OrderedList.cpp
blob: f3a74502424fced0c17b623f4c9d6442f7a2be09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#include "OrderedList.h"

template <class T>
bool OrderedList<T>::insert(const T& element) {
	if (List<T>::length == List<T>::count) List<T>::resize();

	unsigned insertionInd = 0;
	while (List<T>::elements[insertionInd].compare(element) < 0 && insertionInd < List<T>::count)
		insertionInd++;

	return List<T>::insertAt(element, insertionInd);
}