October 2011
Beginner to intermediate
1200 pages
35h 33m
English
Constructors that use C-style strings let you initialize a string object from a C-style string; more generally, they let you initialize a charT specialization from an array of charT values:
basic_string(const charT* s, const Allocator& a = Allocator());
To determine how many characters to copy, the constructor applies the traits::length() method to the array pointed to by s. (The pointer s should not be a null pointer.) For example, the following statement initializes the toast object, using the indicated character string:
string toast("Here's looking at you, kid.");
The traits::length() method for type char uses the null character to determine how many characters to copy.
The following relationships hold ...
Read now
Unlock full access