Friday, June 4, 2010

data() and c_str() can invalidate iterators

A call to data() or c_str() can invalidate pointers, references, and iterators referring to characters of a string, because these functions may cause copying of the data to another buffer.

Reference: The C++ Standard Library: A Tutorial and Reference by Nicolai M. Josuttis. Addison-Wesley, 1999, p. 488.

No comments:

Post a Comment