   boost / stl algorithm replacement?
  Is there a neater way to do this with the stl algorithms (and boost) instead of the for loops? I can't really think of one (I thought maybe unique or unique_copy, or something might work, but couldn't see how).It doesn't really matter, but I'm just curious to see if this could be made rather more elegant. Use of boost bind / lambda is fine.// Component / widget class.struct TestClass {TestClass(bool resizeable, int size):resizeable(resizeable), size(size) {}bool getResizeable() const {return resizeable;}int getSize() const {return size;}// placeholder for proper overlap comparisonbool overlaps(int s) const {if (s == size) {return true;}return false;}bool resizeable;// placeholder for proper sizeint size;};// ...typedef std::vector<boost::shared_ptr<TestClass> > items_type;items_type items;// fill container ...// Start with a container filled with widgets. Some widgets are automatically layed out (getResizeable == true). // Others have their size specified.// Partition between resizeable (auto-layout) items and size specified items.items_type::size_type endAutoLayout = std::partition(items.begin(), items.end(), boost::mem_fn(&TestClass::getResizeable)) - items.begin();// REPLACEMENT FROM HERE DOWN.// Go through the size specified items. // If two of them overlap, move one of the items to the start of the partition and increment endAutoLayout, so it'll be layed out automatically too.int count = 0;for (items_type::size_type i = endAutoLayout; i != items.size()-1; ++i) {int size = items->getSize();for (items_type::size_type j = i+1; j != items.size(); ++j) {if (items->overlaps(items[j]->getSize())) {items.insert(items.begin() + endAutoLayout, *(items.begin()+j));items.erase(items.begin() + j + 1);++count;}}}endAutoLayout += count;// ...