String’s length | Andrzej's C++ blog

String’s length | Andrzej's C++ blog

瀏覽:1393
日期:2024-05-10
Let’s start with a small test. Is the equivalence 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 yo...看更多