# front

### Synopsis

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

### Description

Returns a type identical to the first element in the sequence.

### Definition

    #include "boost/mpl/front.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 front<Sequence>::type t;` | A type | `empty<Sequence>::type::value == false` | Equivalent to `typedef begin<Sequence>::type::type t;` |

### Complexity

Amortized constant time.

### Example

    typedef list<long>::type types1;
    typedef list<int,long>::type types2;
    typedef list<char,int,long>::type types3;

    BOOST_MPL_ASSERT_IS_SAME(front<types1>::type, long);
    BOOST_MPL_ASSERT_IS_SAME(front<types2>::type, int);
    BOOST_MPL_ASSERT_IS_SAME(front<types3>::type, char);

### See also

Forward Sequence, `back`, `at`, `push_front`, `begin`, `empty`

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