how would you check if the iterator that was returned by the function points to something in container cl开发者_开发技巧ass?
Iterators are passed around as [begin,end) pairs, with the end value signifying "not found" or other forms of the empty sequence. Return that from your function, or return a pair<bool,iterator>
(or similar).
You can't. Make sure you return a valid iterator.
Well I suppose you could by iterating through the container and checking to see if the iterators are equal. But that would be horrid.
精彩评论