...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 last element in the sequence.
template <typename Sequence> typename result_of::back<Sequence>::type back(Sequence& seq); template <typename Sequence> typename result_of::back<Sequence const>::type back(Sequence const& seq);
Parameter |
Requirement |
Description |
---|---|---|
seq |
Model of Bidirectional Sequence |
The sequence we wish to investigate. |
back(seq);
Return type: Returns a reference to the last element in the sequence seq if seq is mutable and e = o, where e is the last element in the sequence, is a valid expression. Else, returns a type convertable to the last element in the sequence.
Precondition: empty(seq) == false
Semantics: Returns the last element in the sequence.
#include <boost/fusion/sequence/intrinsic/back.hpp> #include <boost/fusion/include/back.hpp>
vector<int, int, int> v(1, 2, 3); assert(back(v) == 3);