| Home | Libraries | People | FAQ | More

###### string::insert (2 of 4 overloads)

Insert a character.

<h7> Synopsis </h7>

    string&
    insert(
        std::size_t pos,
        std::size_t count,
        char ch);

<h7> Description </h7>

Inserts `count` copies of `ch` at the position `pos`.

<h7> Exception Safety </h7>

Strong guarantee.

<h7> Remarks </h7>

All references, pointers, or iterators referring to contained elements are invalidated. Any past-the-end iterators are also invalidated.

<h7> Return Value </h7>

`*this`

<h7> Parameters </h7>

Name | Description
--- | ---
`pos` | The index to insert at.
`count` | The number of characters to insert.
`ch` | The character to insert.

<h7> Exceptions </h7>

Type | Thrown On
--- | ---
`std::length_error` | `size() + count > max_size()`
`std::out_of_range` | `pos > size()`