...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 M-th element from the beginning of the sequence.
template <typename M, typename Sequence> typenameresult_of::at
<Sequence, N>::type at(Sequence& seq); template <typename M, typename Sequence> typenameresult_of::at
<Sequence const, N>::type at(Sequence const& seq);
Parameter |
Requirement |
Description |
---|---|---|
|
Model of Random Access Sequence |
The sequence we wish to investigate. |
|
An index from the beginning of the sequence. |
at<M>(seq);
Return type: Returns a reference to
the M-th element from the beginning of the sequence seq
if seq
is mutable and
e =
o
, where e
is the M-th element from the beginning of the sequence, is a valid expression.
Else, returns a type convertible to the M-th element from the beginning
of the sequence.
Precondition: 0
<= M::value <
(where size
(seq)seq
is not Unbounded Sequence)
Semantics: Equivalent to
deref
(advance
<M>(begin
(s)))
#include <boost/fusion/sequence/intrinsic/at.hpp> #include <boost/fusion/include/at.hpp>
vector
<int, int, int> v(1, 2, 3);
assert(at<mpl::int_<1> >(v) == 2);