Are standard iterator operations allowed to throw?
<p>Consider a standard iterator where it is necessary to allocate memory for traversing a data structure. Does the standard allow an iterator to throw an exception if memory cannot be allocated? As an example, think of an input iterator for tree data structures. In this case, to traverse the tree you have to either add and maintain a pointer to the parent of each node (which would slow down operations not needing such a pointer, as for insert/erase/find on the tree) or use a stack to help the iterator store the pointers to the traversed nodes. In this case, while advancing the stack could grow until there is no more free memory and the iterator is compelled to throw.</p>
