I am reading C++ promer 5 ed. I'm reading it so carefully because it is really useful. I also practise too much from what I've learned from it. Now I am on chapter 13. move semantics. nove iterators. everything is clear until I reached this paragraph:
It is worth noting that standard library makes no guarantees about which algorithms can be used with move iterators and which cannot. Because moving an object can obliterate the source, you should pass move iterators to algorithms only when you are confident that the algorithm does not access an element after it has assigned to that element or passed that element to a user-defined function.
Can someone explain tp me this paragraph? I didn't understand "you should pass move iterators to algorithms only when you are confident that the algorithm does not access an element after it has assigned to that element or passed that element to a user-defined function."?? which element he is talking about? Thank you guys!
Aucun commentaire:
Enregistrer un commentaire