# reverse

### Synopsis

    template<
          typename Sequence
        >
    struct reverse
    {
        typedef implementation-defined type;
    };

### Description

Reverses a sequence. The result sequence preserves all the functional and performance characteristics of the original `Sequence`, including its size, but not identity.

### Definition

    #include "boost/mpl/reverse.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Extensible Sequence | The original sequence.

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef reverse<Sequence>::type s;` | A model of Extensible Sequence |  |  | `size<s>::type::value == size<Sequence>::type::value`.

### Complexity

Linear.

### Example

    typedef list_c<int,9,8,7,6,5,4,3,2,1,0>::type numbers;
    typedef reverse< numbers >::type result;

    typedef range_c<int,0,10> answer;
    BOOST_STATIC_ASSERT((equal<result,answer>::type::value));

### See also

Algorithms, `transform`, `remove`, `remove_if`

Table of Contents
Last edited March 10, 2003 6:13 am