bsl::basic_string::basic_string

Create a string from the first numChars of characterString.

Synopsis

Declared in <bslstl_string.h>

basic_string(
    CHAR_TYPE const* characterString,
    size_type numChars,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Description

Create a string that has the same value as the substring of the optionally specified numChars length starting at the beginning of the specified characterString. If numChars is not specified, CHAR_TRAITS::length(characterString) is used. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, a default-constructed allocator is used. Throw out_of_range if numChars >= npos.

Parameters

NameDescription
characterStringcharacter array used to initialize the string
numCharsnumber of characters to take from characterString
basicAllocatorallocator used to supply memory