共用方式為


forward_list::forward_list

Constructs an object of type forward_list.

forward_list();
explicit forward_list(const Allocator& Al);
explicit forward_list(size_type Count);
forward_list(size_type Count, const Type& Val);
forward_list(size_type Count, const Type& Val,
    const Allocator& Al);
forward_list(const forward_list& Right);
forward_list(const forward_list& Right, const Allocator& Al);
forward_list(forward_list&& Right); 
forward_list(forward_list&& Right, const Allocator& Al);
forward_list(
initializer_list<Type> IList,
    const Alloc& Al
);
template<class InputIterator>
    forward_list(InputIterator First, InputIterator Last);
template<class InputIterator>
    forward_list(InputIterator First, InputIterator Last,
    const Allocator& Al
);

Parameters

Parameter

Description

Al

The allocator class to use with this object.

Count

The number of elements in the list constructed.

Val

The value of the elements in the list constructed.

Right

The list of which the constructed list is to be a copy.

First

The position of the first element in the range of elements to be copied.

Last

The position of the first element beyond the range of elements to be copied.

IList

The initializer_list to copy.

Remarks

All constructors store an allocator and initialize the controlled sequence. The allocator object is the argument Al, if present. For the copy constructor, it is _Right.get_allocator(). Otherwise, it is Allocator().

The first two constructors specify an empty initial controlled sequence.

The third constructor specifies a repetition of Count elements of value Type().

The fourth and fifth constructors specify a repetition of Count elements of value Val.

The sixth constructor specifies a copy of the sequence controlled by Right. If InputIterator is an integer type, the next two constructors specify a repetition of (size_type)First elements of value (Type)Last. Otherwise, the next two constructors specify the sequence [First, Last).

The ninth and tenth constructors are the same as the sixth, but with an rvalue reference.

The last constructor specifies the initial controlled sequence with an object of class initializer_list<Type>.

Requirements

Header: <forward_list>

Namespace: std

See Also

Reference

forward_list Class