Front Page / Sequences / Intrinsic Metafunctions / front |
Returns the first element in the sequence.
#include <boost/mpl/front.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Forward Sequence | A sequence to be examined. |
For any Forward Sequence s:
typedef front<s>::type t;
Return type: | A type. |
---|---|
Precondition: | empty<s>::value == false. |
Semantics: | Equivalent to typedef deref< begin<s>::type >::type t; |
Amortized constant time.
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> ));