at_c
template<
long n
, typename Sequence
>
struct at_c
{
typedef unspecified type;
};
Returns a type identical to the n-th element from the beginning of the sequence. at_c<n,Sequence>::type is a shorcut notation for at< integral_c<long,n>, Sequence>::type.
#include "boost/mpl/at.hpp"
| Parameter | Requirement | Description |
|---|---|---|
n | An compile-time integral constant | An offset from the beginning of the sequence that specifies the element to be retrieved. |
Sequence | A model of Forward Sequence | A sequence being examined. |
| Expression | Expression type | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
typedef at_c<n,Sequence>::type t; | A type | 0 <= n < size<Sequence>::type::value | Equivalent to typedef at< integral_c<long,n>, Sequence>::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_c<0,range>::type::value == 10); BOOST_STATIC_ASSERT(at_c<10,range>::type::value == 20); BOOST_STATIC_ASSERT(at_c<40,range>::type::value == 50);
Forward Sequence, at, front, back