Compartilhar via


forward_list::assign

Erases elements from a forward list and copies a new set of elements to a target forward list.

void assign(
    size_type Count, 
    const Type& Val
);
void assign(
    initializer_list<Type> IList
);
template<class InputIterator>
    void assign(InputIterator First, InputIterator Last
    );

Parameters

Parameter

Description

_First

The beginning of the replacement range.

_Last

The end of the replacement range.

_Count

The number of elements to assign.

_Val

The value to assign each element.

Type

The type of the value.

IList

The initializer_list to copy.

Remarks

If the forward_list is an integer type, the first member function behaves the same as assign((size_type)First, (Type)Last). Otherwise, the first member function replaces the sequence controlled by *this with the sequence [First, Last), which must not overlap the initial controlled sequence.

The second member function replaces the sequence controlled by *this with a repetition of Count elements of value Val.

The third member function copies the elements of the initializer_list into the forward_list.

Requirements

Header: <forward_list>

Namespace: std

See Also

Reference

forward_list Class