Boost C++ Libraries 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 for the latest Boost documentation.



      typename Sequence
    , typename N
struct at
    typedef unspecified type;


Returns a type identical to the N-th element from the beginning of the sequence.


#include "boost/mpl/at.hpp"


 Parameter  Requirement  Description  
SequenceA model of Forward SequenceA sequence to be examined.
NA model of Integral ConstantThe offset from the beginning of the sequence that specifies the element to be retrieved.

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef at<Sequence,N>::type t;A type0 <= N::value < size<Sequence>::type::valueEquivalent to typedef advance< begin<Sequence>::type,N >::type::type t;


Depends on the implementation of the particular sequence it is applied to. Linear in the worst case, or amortized constant time.


typedef range_c<long,10,50> range;
BOOST_STATIC_ASSERT(at< range, int_<0> >::type::value == 10);
BOOST_STATIC_ASSERT(at< range, int_<10> >::type::value == 20);
BOOST_STATIC_ASSERT(at< range, int_<40> >::type::value == 50);

See also

Forward Sequence, at_c, front, back

Table of Contents
Last edited March 12, 2003 6:26 am