I'm trying to get this one routine to work for my homework, but I just don't understand why this doesn't even compile:
Code:
template <typename T>
void insertOrder(list<T>& orderedList, const T& item)
{
// curr starts at first list element, stop marks end
list<T>::iterator curr = orderedList.begin(),
stop = orderedList.end();
// find the insertion point, which may be at end of list
while ((curr != stop) && (*curr < item))
curr++;
// do the insertion using insert()
orderedList.insert(curr, item);
}
the error says it expected a semicolon before "curr"