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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
reverse
Description

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

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

Table 1.61. Parameters

Parameter

Requirement

Description

seq

A model of Bidirectional Sequence

Operation's argument

Expression Semantics
reverse(seq);

Return type: A model of Bidirectional Sequence.

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