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

Name

Description

characterString

character array used to initialize the string

numChars

number of characters to take from characterString

basicAllocator

allocator used to supply memory

Created with MrDocs