# back

### Synopsis

    template<
          typename Sequence
        >
    struct back
    {
        typedef unspecified type;
    };

### Description

Returns a type identical to the last element in the sequence, that is, the element in a position that preceeds the position of past-the-end iterator.

### Definition

    #include "boost/mpl/back.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Forward Sequence | A sequence to be examined.

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef back<Sequence>::type t;` | A type | `empty<Sequence>::type::value == false` | Equivalent to `typedef prior< end<Sequence>::type >::type::type t;` |

### Complexity

Amortized constant time [1].

### Example

    typedef range_c<int,0,1> range1;
    typedef range_c<int,0,10> range2;
    typedef range_c<int,-10,0> range3;

    BOOST_STATIC_ASSERT(back<range1>::type::value == 0);
    BOOST_STATIC_ASSERT(back<range2>::type::value == 9);
    BOOST_STATIC_ASSERT(back<range3>::type::value == -1);

### Notes

[1] The algorithm is provided only if the sequence can meet the stated complexity requirements.

### See also

Forward Sequence, `front`, `at`, `end`, `push_back`

Table of Contents
Last edited July 17, 2002 3:47 am