Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext
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:

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));

PrevUpHomeNext