Constructors

Synopses

Declared in <bslstl_string.h>

Create an empty string using a default‐constructed allocator.

basic_string() noexcept;

Create a string having the same value as the specified original.

basic_string(basic_string const& original);

A string cannot be constructed from a null pointer.

basic_string(bsl::nullptr_t unused) = delete;

Create a basic_string object.

Create a basic_string object.

explicit
basic_string(ALLOCATOR const& basicAllocator) noexcept;

Create a basic_string object.

template<class STRING_VIEW_LIKE_TYPE>
explicit
basic_string(STRING_VIEW_LIKE_TYPE const& object);

Create a basic_string object.

basic_string(
    BloombergLP::bslmf::MovableRef<basic_string> original,
    ALLOCATOR const& basicAllocator);

Create a basic_string object.

basic_string(
    std::initializer_list<CHAR_TYPE> values,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a string that has the same value as the specified original string and uses the specified basicAllocator to supply memory.

basic_string(
    basic_string const& original,
    ALLOCATOR const& basicAllocator);

Create a basic_string object.

basic_string(
    BloombergLP::bslstl::StringRefData<CHAR_TYPE> const& strRef,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a string from a null‐terminated character string.

template<>
requires bsl::IsStdAllocator<ALLOCATOR>::value
basic_string(
    CHAR_TYPE const* characterString,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a basic_string object.

template<class ALLOC2>
basic_string(
    std::basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOC2> const& original,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a basic_string object.

basic_string(
    BloombergLP::bslmf::MovableRef<basic_string> original,
    size_type position,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a basic_string object.

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

Create a string from the first numChars of characterString.

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

Create a string filled with copies of a character.

template<>
requires bsl::IsStdAllocator<ALLOCATOR>::value
basic_string(
    size_type numChars,
    CHAR_TYPE character,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a basic_string object.

template<class INPUT_ITER>
basic_string(
    INPUT_ITER first,
    INPUT_ITER last,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a basic_string object.

template<class RANGE>
basic_string(
    std::from_range_t tag,
    RANGE&& range,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a basic_string object.

basic_string(
    BloombergLP::bslmf::MovableRef<basic_string> original,
    size_type position,
    size_type numChars,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Create a basic_string object.

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

Create a basic_string object.

template<class STRING_VIEW_LIKE_TYPE>
basic_string(
    STRING_VIEW_LIKE_TYPE const& object,
    size_type position,
    size_type numChars,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Parameters

Name

Description

original

string whose value is copied

unused

unused; this constructor is deleted

basicAllocator

allocator used to supply memory

object

source object providing characters

values

initializer list of characters

strRef

string reference providing characters

characterString

null‐terminated string used to initialize this string

position

starting index

numChars

number of characters to take from characterString

character

character value used to fill the string

first

beginning of the range (inclusive)

last

end of the range (exclusive)

tag

disambiguation tag for range construction

range

input range of characters

Created with MrDocs