Create a string reference to a substring.

Synopsis

Declared in <bslstl_stringref.h>

StringRefImp(
    StringRefImp const& original,
    size_type startIndex,
    size_type numCharacters);

Description

Create a string‐reference object having a valid std::string value, whose external representation begins at the specified startIndex in the specified original string reference, and extends either the specified numCharacters or until the end of the original string reference, whichever comes first. The external representation must remain valid as long as it is bound to this string reference. The behavior is undefined unless startIndex <= original.length(). Note that if startIndex is original.length() an empty string reference is returned.

Parameters

Name

Description

original

string reference providing the external data

startIndex

starting index within original

numCharacters

maximum number of characters to reference

Created with MrDocs