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); }