| Home | Libraries | People | FAQ | More

###### string::operator= (3 of 4 overloads)

Assign a value to the string.

<h7> Synopsis </h7>

    string&
    operator=(
        char const* s);

<h7> Description </h7>

Replaces the contents with those of the null terminated string pointed to by `s`. The length of the string is determined by the first null character.

<h7> Complexity </h7>

Linear in `std::strlen(s)`.

<h7> Exception Safety </h7>

Strong guarantee. Calls to `memory_resource::allocate` may throw.

<h7> Return Value </h7>

`*this`

<h7> Parameters </h7>

Name | Description
--- | ---
`s` | The null-terminated character string.

<h7> Exceptions </h7>

Type | Thrown On
--- | ---
`std::length_error` | `std::strlen(s) > max_size()`.