다음을 통해 공유


initializer_list Class

Provides access to an array of elements in which each member is of the specified type.

template<
    class Type >
    class initializer_list

Parameters

Parameter

Description

_Elem

The element data type to be stored in the initializer_list.

_First

The pointer to the first element of the initializer_list.

_Last

The pointer to the last element of the initializer_list.

Remarks

An initializer_list can be constructed using a braced initializer list:

initializer_list<int> i1{ 1, 2, 3, 4 };

The compiler transforms braced initializer lists with homogeneous elements into an initializer_list whenever the function signature requires an initializer_list. For more details on using initializer_list, see Uniform Initialization and Delegating Constructors

Constructors

initializer_list

Constructs an object of type initializer_list.

Typedefs

value_type

The type of the elements in the initializer_list.

reference

A type that provides a reference to an element in the initializer_list.

const_reference

A type that provides a constant reference to an element in the initializer_list.

size_type

A type that represents the number of elements in the initializer_list.

iterator

A type that provides an iterator for the initializer_list.

const_iterator

A type that provides a constant iterator for the initializer_list.

Member Functions

begin

Returns a pointer to the first element in an initializer_list.

end

Returns a pointer to one past the last element in an initializer_list.

size

Returns the number of elements in the initializer_list.

Requirements

Header: <initializer_list>

Namespace: std

See Also

Reference

<forward_list>