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

Synopsis

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

Description

Returns an iterator that points to the first element of the sequence.

Definition

#include "boost/mpl/begin_end.hpp"

Parameters

 Parameter  Requirement  Description  
SequenceA model of Sequence

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef begin<Sequence>::type first;A model of Input Iteratorfirst is an iterator pointing to the first element of the Sequence; equivalent to Sequence::begin unless the algorithm has been specialized for the particular type of sequence.first is either dereferenceable or past-the-end; it is past-the-end if and only if size<Sequence>::type::value == 0.

Complexity

Amortized constant time.

Example

typedef vector<unsigned char,unsigned short,unsigned int, unsigned long> unsigned_types;
typedef begin<unsigned_types>::type iter;
BOOST_STATIC_ASSERT((boost::is_same<iter::type,unsigned char>::value));

See also

Iterators, Sequence, end, size, empty


Table of Contents
Last edited July 22, 2002 2:03 am