October 2011
Beginner to intermediate
1200 pages
35h 33m
English
Constructors that use part of a C-style string let you initialize a string object from part of a C-style string; more generally, they let you initialize a charT specialization from part of an array of charT values:
basic_string(const charT* s, size_type n, const Allocator& a = Allocator());
This constructor copies to the constructed object a total of n characters from the array pointed to by s. Note that it doesn’t stop copying if s has fewer characters than n. If n exceeds the length of s, the constructor interprets the contents of memory following the string as if they held data of type charT.
This constructor requires that s is not a null pointer and that n < npos. (Recall that npos is a static ...
Read now
Unlock full access