...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Sequences / Intrinsic Metafunctions / at_c |
Returns a type identical to the nth element from the beginning of the sequence. at_c<Sequence,n>::type is a shorcut notation for at< Sequence, long_<n> >::type.
#include <boost/mpl/at.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Forward Sequence | A sequence to be examined. |
n | A compile-time integral constant | An offset from the beginning of the sequence specifying the element to be retrieved. |
typedef at_c<Sequence,n>::type t;
Return type: | A type |
---|---|
Precondition: | 0 <= n < size<Sequence>::value |
Semantics: | Equivalent to typedef at< Sequence, long_<n> >::type t; |
Sequence archetype | Complexity |
---|---|
Forward Sequence | Linear. |
Random Access Sequence | Amortized constant time. |
typedef range_c<long,10,50> range; BOOST_MPL_ASSERT_RELATION( (at_c< range,0 >::value), ==, 10 ); BOOST_MPL_ASSERT_RELATION( (at_c< range,10 >::value), ==, 20 ); BOOST_MPL_ASSERT_RELATION( (at_c< range,40 >::value), ==, 50 );