Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
basic_static_string::assign (9 of 9 overloads)

Assign to the string.

Synopsis
template<
    [role red error.param neither has a declname nor a 'class ' prefix in the type][role red error.param neither has a declname nor a 'class ' prefix in the type][role red error.param neither has a declname nor a 'class ' prefix in the type][role red error.param neither has a declname nor a 'class ' prefix in the type]>
basic_static_string&
assign(
    const T& t,
    size_type pos,
    size_type count = npos);
Description

Replaces the contents with those of the substring sv, where sv is string_view_type(t).substr(pos, count).

Complexity

Linear in sv.size().

Exception Safety

Strong guarantee.

Remarks

The view can contain null characters.

Template Parameters

Type

Description

T

A type convertible to string_view_type.

Constraints
std::is_convertible<const T&, string_view>::value &&
!std::is_convertible<const T&, const CharT*>::value
Return Value

*this

Parameters

Name

Description

t

The object to assign from.

pos

The index at which to begin the substring.

count

The size of the substring. The default argument for this parameter is npos.

Exceptions

Type

Thrown On

std::length_error

sv.size() > max_size().


PrevUpHomeNext