COMMON: Fix SortedArray implementation for empty array

This commit is contained in:
Eugene Sandulenko 2016-05-23 16:08:17 +02:00
parent 1f8667c5d9
commit 3d89af272b

View file

@ -378,6 +378,11 @@ public:
* Inserts element at the sorted position.
*/
void insert(const T &element) {
if (!this->_size) {
this->insert_aux(this->_storage, &element, &element + 1);
return;
}
T *where = (T *)bsearchMin(element, this->front(), this->_size, sizeof(T), _comparator);
insert(where, element);
}