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