...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Returns the first element in the sequence.
template <typename Sequence> typename result_of::front<Sequence>::type front(Sequence& seq); template <typename Sequence> typename result_of::front<Sequence const>::type front(Sequence const& seq);
Parameter |
Requirement |
Description |
---|---|---|
seq |
Model of Forward Sequence |
The sequence we wish to investigate. |
front(seq);
Return type: Returns a reference to the first element in the sequence seq if seq is mutable and e = o, where e is the first element in the sequence, is a valid expression. Else, returns a type convertable to the first element in the sequence.
Precondition: empty(seq) == false
Semantics: Returns the first element in the sequence.
#include <boost/fusion/sequence/intrinsic/front.hpp> #include <boost/fusion/include/front.hpp>
vector<int, int, int> v(1, 2, 3); assert(front(v) == 1);