Namespaces
Variants
Views
Actions

std::{{{1}}}::{{{1}}}

From cppreference.com
Revision as of 13:02, 4 July 2011 by Nate (Talk | contribs)

Template:cpp/container//sidebar Template:ddcl list begin <tr class="t-dcl ">

<td >
explicit {{{1}}}( const Allocator& alloc = Allocator() );
</td>

<td > (1) </td> <td > Template:cpp/container/mark c++0x feature </td> </tr> <tr class="t-dcl ">

<td >
explicit {{{1}}}( size_type count,

                  const T& value = T(),
                  const Allocator& alloc = Allocator());
         {{{1}}}( size_type count,
                  const T& value,

                  const Allocator& alloc = Allocator());
</td>

<td > (2) </td> <td > Template:mark pre c++0x version


Template:mark c++0x version </td> </tr> <tr class="t-dcl ">

<td >
explicit {{{1}}}( size_type count );
</td>

<td > (3) </td> <td > Template:mark c++0x feature </td> </tr> <tr class="t-dcl ">

<td >
template <class InputIterator>

{{{1}}}( InputIterator first, InputIterator last,

         const Allocator& alloc = Allocator() );
</td>

<td > (4) </td> <td > Template:cpp/container/mark c++0x feature </td> </tr> <tr class="t-dcl ">

<td >
{{{1}}}( const {{{1}}}& other );
</td>

<td > (5) </td> <td > Template:cpp/container/mark c++0x feature </td> </tr> <tr class="t-dcl ">

<td >
{{{1}}}( const {{{1}}}& other, const Allocator& alloc );
</td>

<td > (5) </td> <td > Template:mark c++0x feature </td> </tr> <tr class="t-dcl ">

<td >
{{{1}}}( {{{1}}}&& other )
</td>

<td > (6) </td> <td > Template:mark c++0x feature </td> </tr> <tr class="t-dcl ">

<td >
{{{1}}}( {{{1}}}&& other, const Allocator& alloc );
</td>

<td > (6) </td> <td > Template:mark c++0x feature </td> </tr> <tr class="t-dcl ">

<td >
{{{1}}}( std::initializer_list<T> init,
         const Allocator& alloc = Allocator() );
</td>

<td > (7) </td> <td > Template:mark c++0x feature </td> </tr> Template:ddcl list end

Constructs new container from a variety of data sources and optionally using user supplied allocator alloc.

1) default constructor. Constructs empty container.

2) constructs the container with count copies of elements with value value.

3) constructs the container with count copies of elements with value Template:cpp.

4) constructs the container with the contents of the range [first, last).

5) copy constructor. Constructs the container with the copy of the contents of other.

6) move constructor. Constructs the container with the contents of other using move semantics.

7) constructs the container with the contents of the initializer list init.

Template:params

alloc - allocator to use for all memory allocations of this container
count - the size of the container
value - the value to initialize elements of the container with
first, last - the range to copy the elements from
other - another container to be used as source to initialize the elements of the container with
init - initializer list to initialize the elements of the container with

Template:complex

1) constant

2-3) linear in count

4) linear in distance between first and last

5) linear in size of other

6) constant. If alloc is given and Template:cpp, then linear.

7) linear in size of init

Template:example cpp

Template:see also

Template:cpp/container/dcl list assignTemplate:cpp/container/dcl list operator=