| Home | Libraries | People | FAQ | More

#### basic_static_string::resize_and_overwrite

Resize the string and overwrite its contents.

###### Synopsis

    template<
        typename Operation>
    constexpr void
    resize_and_overwrite(
        basic_static_string::size_type n,
        Operation op);

###### Description

Resizes the string to contain `n` characters, and uses the provided function object `op` to overwrite the string contents. The function object is called with two arguments: a pointer to the string internal buffer, and the size of the string. The function object shall return the number of characters written to the buffer, which shall be less than or equal to `n`. The string size is set to the value returned by the function object.

###### Exception Safety

Strong guarantee. However, if an exception is thrown by `std::move(op)(p, count)`, the behavior is undefined.

###### Exceptions

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