
Does boost provide any sort of iterator adapter which can be used as a forward iterator through a collection, but which will act like an output iterator upon reaching the end and push back new values? I am looking for something which will allow me to build a collection as though I was using an output iterator, but will also allow me to save copies of the current iterator so that I can modify the values they point to later. If there isn't, should I roll my own, or is there a better way to do what I want? If I do roll my own, would people be interested in seeing it developed into a boost library? Sidenote: This iterator adapter would require push_back to not invalidate existing iterators (other than end). Therefore, a special iterator might need to be specified when wrapping certain collections. For instance, random access containers (vector and deque) would probably need iterators that stored an integer index and a pointer to the container, because push_back would be likely to result in memory reallocations.