// sort a vector in-place using an avl tree # include template void treeSort(vector & v) { // declare an search tree of the correct type avlTree sorter; // copy the entire vector into the tree vectorIterator vitr(v); for (vitr.init(); ! vitr; vitr++) sorter.add(vitr()); // now copy the values back into the array int i = 0; searchTreeIterator itr(sorter); for (itr.init(); ! itr; itr++) v[i++] = itr(); }