bsl::basic_string::basic_string

Constructors

Synopses

Declared in <bslstl_string.h>

Create an empty string using a default-constructed allocator.

basic_string() noexcept;
» more...

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

basic_string(basic_string const& original);
» more...

A string cannot be constructed from a null pointer.

basic_string(bsl::nullptr_t unused) = delete;
» more...

Create a basic_string object.

basic_string(BloombergLP::bslmf::MovableRef<basic_string> original) noexcept;
» more...

Create a basic_string object.

explicit
basic_string(ALLOCATOR const& basicAllocator) noexcept;
» more...

Create a basic_string object.

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

Create a basic_string object.

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

Create a basic_string object.

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

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);
» more...

Create a basic_string object.

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

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());
» more...

Create a basic_string object.

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

Create a basic_string object.

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

Create a basic_string object.

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

Create a string from the first numChars of characterString.

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

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());
» more...

Create a basic_string object.

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

Create a basic_string object.

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

Create a basic_string object.

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

Create a basic_string object.

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

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());
» more...

Parameters

NameDescription
originalstring whose value is copied
unusedunused; this constructor is deleted
basicAllocatorallocator used to supply memory
objectsource object providing characters
valuesinitializer list of characters
strRefstring reference providing characters
characterStringnull-terminated string used to initialize this string
positionstarting index
numCharsnumber of characters to take from characterString
charactercharacter value used to fill the string
firstbeginning of the range (inclusive)
lastend of the range (exclusive)
tagdisambiguation tag for range construction
rangeinput range of characters