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 an old version of boost. Click here for the latest version's documentation home page.

[Home]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  
SequenceA model of Extensible SequenceThe original sequence.

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef reverse<Sequence>::type s;A model of Extensible Sequencesize<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