| Home | Libraries | People | FAQ | More

###### string::string (6 of 12 overloads)

Constructor.

<h7> Synopsis </h7>

    string(
        char const* s,
        std::size_t count,
        storage_ptr sp = {});

<h7> Description </h7>

Construct the contents with copies of the characters in the range `{s, s+count)`. This range can contain null characters.

<h7> Complexity </h7>

Linear in `count`.

<h7> Exception Safety </h7>

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

<h7> Parameters </h7>

Name | Description
--- | ---
`count` | The number of characters to copy.
`s` | A pointer to a character string used to copy from.
`sp` | An optional pointer to the `memory_resource` to use. The container will acquire shared ownership of the memory resource. The default argument for this parameter is `{}`.

<h7> Exceptions </h7>

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