Working with strings is a big part of every programmer's job. Qt provides its own string implementation, but in this case the problems we had with Qt containers should not deter you from using QString—it is so much better than the std::string class. It has built-in support for Unicode and many convenient functions lacking in std::string. So, we will first have a look at how QString and its supporting classes can be used in an efficient manner.
Working with strings
Qt string classes
The problem with string classes in general is that they will copy the content of the char* string literal when they are created. Avoiding this cost, will be one recurring theme in our discussion. Another problem is avoiding the unnecessary...