The C ++ solution for strings is very different from the c version. The first and most important difference is that using the ASCIIZ solution, std :: string and std :: wstring use two iterators (pointers) to store the actual string. The basic use of string classes provides a dynamic dedicated solution, therefore, in the cost of processor overhead when working with dynamic memory, string processing is more convenient.
As you probably already know, C does not contain a built-in typical string type, it provides only a couple of string operations through the standard library. One of the main differences between C and C ++, which C ++ provides wrapped functionality, so it can be considered as a fake general type.
In C, you need to go through a string if you want to know its length, the member function std :: string :: size () is just one command (end to start). You can safely add lines to each other as long as you have memory, so there is no need to worry about buffer overflow errors (and therefore about exploits), because adding creates a larger buffer, if necessary.
As someone previously said, a string is derived from vector functionality in a standardized way, so working with multi-byte systems is simplified. You can define your own string type using typedef std :: basic_string specific_str_t; expression with any arbitrary data type in the template parameter.
I think there are enough pluses and sides to both sides:
C ++ string Pros: - Faster iteration in certain cases (with certain sizes, and no data from memory is needed to check if you are at the end of a line by comparing two pointers that can affect caching) - The buffer operation is full of functionality strings, so fewer worries about buffer problems.
C ++ line Cons: - Due to the dynamic memory allocation material, the main use can affect performance. (fortunately, you can tell the string object what the original buffer size should be, so if you do not exceed it, it will not allocate dynamic blocks from memory) - often strange and inconsistent names compared to other languages. this is a bad thing about any stl stuff, but you can use it and it creates a slightly specific C ++ feel. - Intensive use of templates makes the standard library use header-based solutions, so this greatly affects compilation time.