Today from the desk of Andrzej:
String's Length
by Andrzej Krzemieński
From the article:
Let’s start with a small test. Is the invariant expressed with the following assertion correct?
void test_length(std::string const& s) { assert(s.length() == strlen(s.c_str())); }It is not; otherwise I wouldn’t be mentioning this in the post; but do you know why it is wrong? ...
Add a Comment
Comments are closed.