<initializer_list>
[added with C++11]
Include the standard
header <initializer_list>
to define
template class initializer_list
, which describes a
brace-enclosed list of initializers, plus two support functions.
namespace std { template<class Ty> class initializer_list; template<class Ty> const Ty *begin(initializer_list<Ty> init) noexcept; template<class Ty> const Ty *end(initializer_list<Ty> init) noexcept; } // namespace std
begin
template<class Ty> const Ty *begin(initializer_list<Ty> init) noexcept;
The function returns a pointer to the first element of the
sequence controlled by the initializer_list
object.
end
template<class Ty> const Ty *end(initializer_list<Ty> init) noexcept;
The function returns a pointer just past the last element of the
sequence controlled by the initializer_list
object.
initializer_list
begin
· const_iterator
· const_reference
· end
· initializer_list
· iterator
· reference
· size
· size_type
· value_type
template<class Ty> class initializer_list { public: typedef size_t size_type; typedef Ty& reference; typedef const Ty& const_reference; typedef const Ty *iterator; typedef const Ty *const_iterator; typedef Ty value_type; initializer_list() noexcept; const Ty *begin() const noexcept; const Ty *end() const noexcept; size_type size() const noexcept; };
The template class describes an object that controls a sequence of
length N
of elements of type Ty
. The object
effectively stores a pair of pointers delimiting the sequence.
The translator replaces a brace-enclosed list of expressions convertible to
Ty
with an object of type initializer_list<Ty>
that designates an array of type const Ty[N}
containing
the expression values.
initializer_list::begin
const Ty *begin() const noexcept;
The member functions return a const pointer that points at the first element of the sequence (or just beyond the end of an empty sequence).
initializer_list::const_iterator
typedef const Ty *const_iterator;
The type describes an object that can server as a constant random-access iterator for the controlled sequence.
initializer_list::const_reference
typedef const Ty& const_reference;
The type describes an object that can serve as a constant reference to an element of the controlled sequence.
initializer_list::end
reference end() const noexcept;
The member functions return a random-access iterator that points just beyond the end of the sequence.
initializer_list::initializer_list
initializer_list() noexcept;
The default constructor initializes the object so that it designates an empty controlled sequence. How the translator constructs an object that designates a non-empty controlled sequence is unspecified.
initializer_list::iterator
typedef const Ty *iterator;
The type describes an object that can server as a random-access iterator for the controlled sequence.
initializer_list::reference
typedef Ty& reference;
The type describes an object that can serve as a reference to an element of the controlled sequence.
initializer_list::size
size_type size() const noexcept;
The member function returns N
.
initializer_list::size_type
typedef size_t size_type;
The unsigned integer type describes an object that can represent the length
of any controlled sequence. It is a synonym for the type size_t
.
initializer_list::value_type
typedef Ty value_type;
The type is a synonym for the template parameter Ty
.
See also the Table of Contents and the Index.
Copyright © 1992-2013 by P.J. Plauger. All rights reserved.