Create and Delete
Explore how to create and efficiently delete C++ strings using multiple methods such as copying, moving, and constructing from substrings or character arrays. Understand the use of C++14 string literals and the string destructor to manage string lifecycles effectively in your programs.
We'll cover the following...
We'll cover the following...
C++ offers many methods to create strings from C or C++ strings. Under the hood, there is always a C string involved for creating a C++string. That changes with C++14, because the new C++ standard supports C++ string literals: std::string str{"string"s}. With the suffix s,the C string literal "string literal" becomes a C++string literal:"string ...