reverse

| Home | Libraries | People | FAQ | More

##### reverse

###### Description

Returns a new sequence with the elements of the original in reverse order.

###### Synopsis

    template<
        typename Sequence
        >
    typename result_of::reverse<Sequence const>::type reverse(Sequence const& seq);

Table 1.74. Parameters

Parameter | Requirement | Description
--- | --- | ---
`seq` | A model of Bidirectional Sequence | Operation's argument

###### Expression Semantics

    reverse(seq);

Return type:

- A model of Bidirectional Sequence if `seq` is a Bidirectional Sequence else, Random Access Sequence if `seq` is a Random Access Sequence.
- A model of Associative Sequence if `seq` implements the Associative Sequence model.

Semantics: Returns a new sequence containing all the elements of `seq` in reverse order.

###### Complexity

Constant. Returns a view which is lazily evaluated.

###### Header

    #include <boost/fusion/algorithm/transformation/reverse.hpp>
    #include <boost/fusion/include/reverse.hpp>

###### Example

    assert(reverse(make_vector(1,2,3)) == make_vector(3,2,1));