Strings

Overview

One of the most common custom types, string, is implemented in the CryStringT template. This class is very like std::string, but exposes a few additional helpers that over the years have simplified engine code, such as built-in reference counting. The two are mostly interchangeable, but internal engine guidelines require the use of its own string implementation.

The template is exposed to code as string, representing CryStringT<char>, and wstring for CryStringT<wchar>.

Performance

It is recommended to only pass raw char pointers, obtained through CryStringT::c_str() - passing strings by value will always result in an expensive copy that can slow down your code considerably.

Usage of strings in interfaces

Do not pass strings across module boundaries; all interfaces should take const char* in their methods.

Conclusion

This concludes the article on strings, you may be interested in: