# push_back

### Synopsis

    template<
          typename Sequence
        , typename T
        >
    struct push_back
    {
        typedef unspecified type;
    };

### Description

`push_back` performs an insertion at the end of the sequence. The algorithm returns a new sequence which contains type `T` as its last element. The result sequence preserves all the functional and performance characteristics of the original `Sequence`, except its size and identity.

### Definition

    #include "boost/mpl/push_back.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Extensible Sequence | A sequence to handle the insert operation.
`T` | A type | The element to be inserted.

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef push_back<Sequence,T>::type s;` | A model of Extensible Sequence | Equivalent to `typedef insert< Sequence,end<Sequence>::type,T >::type s;` | `size<s>::type::value == size<Sequence>::type::value + 1`; `back<s>::type` is identical to `T`

### Complexity

Amortized constant time [1].

### Example

    typedef vector_c<bool,false,false,false,true,true,true,false,false> bools;
    typedef push_back<bools,false_c>::type message;
    BOOST_STATIC_ASSERT(back<message>::type::value == false);
    BOOST_STATIC_ASSERT((count_if<message, equal_to<_,false_c> >::type::value == 6));

### Notes

[1] The algorithm is can be viewed as a notational shorcut to more verbose `insert< Sequence,end<Sequence>::type,T >::type`, and is provided only if the sequence can meet the stated complexity requirements.

### See also

Extensible Sequence, `insert`, `back`, `pop_back`, `push_front`

Table of Content | Reference
Last edited July 17, 2002 3:57 am