bsl::basic_string::basic_string

Create a basic_string object.

Synopsis

Declared in <bslstl_string.h>

basic_string(
    basic_string const& original,
    size_type position,
    size_type numChars,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Description

Create a string that has the same value as the substring of the specified numChars length starting at the specified position in the specified original string. If numChars equals npos, then the remaining length of the string is used (i.e., numChars is set to original.length() - position). Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, a default-constructed allocator is used. Throw out_of_range if position > original.length().

Parameters

NameDescription
originalsource string
positionstarting index
numCharsnumber of characters
basicAllocatorallocator used to supply memory