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

Synopsis

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

Description

Returns a type identical to the first element in the sequence.

Definition

#include "boost/mpl/front.hpp"

Parameters

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

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef front<Sequence>::type t;A typeempty<Sequence>::type::value == falseEquivalent to typedef begin<Sequence>::type::type t;

Complexity

Amortized constant time.

Example

typedef list<long>::type types1;
typedef list<int,long>::type types2;
typedef list<char,int,long>::type types3;

BOOST_MPL_ASSERT_IS_SAME(front<types1>::type, long); BOOST_MPL_ASSERT_IS_SAME(front<types2>::type, int); BOOST_MPL_ASSERT_IS_SAME(front<types3>::type, char);

See also

Forward Sequence, back, at, push_front, begin, empty


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