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]back

Synopsis

template<
      typename Sequence
    >
struct back
{
    typedef unspecified type;
};

Description

Returns a type identical to the last element in the sequence, that is, the element in a position that preceeds the position of past-the-end iterator.

Definition

#include "boost/mpl/back.hpp"

Parameters

 Parameter  Requirement  Description  
SequenceA model of Forward SequenceA sequence to be examined.

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef back<Sequence>::type t;A typeempty<Sequence>::type::value == falseEquivalent to typedef prior< end<Sequence>::type >::type::type t;

Complexity

Amortized constant time [1].

Example

typedef range_c<int,0,1> range1;
typedef range_c<int,0,10> range2;
typedef range_c<int,-10,0> range3;

BOOST_STATIC_ASSERT(back<range1>::type::value == 0); BOOST_STATIC_ASSERT(back<range2>::type::value == 9); BOOST_STATIC_ASSERT(back<range3>::type::value == -1);

Notes

[1] The algorithm is provided only if the sequence can meet the stated complexity requirements.

See also

Forward Sequence, front, at, end, push_back


Table of Contents
Last edited July 17, 2002 3:47 am