...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The sequence_facade template provides an intrusive mechanism for producing a conforming Fusion iterator.
template<typename Derived, typename TravesalTag, typename IsView = mpl::false_> struct sequence_facade;
The user of sequence_facade derives his sequence type from a specialization of sequence_facade and passes the derived sequence type as the first template parameter. The second template parameter should be the traversal category of the sequence being implemented. The 3rd parameter should be set to mpl::true_ if the sequence is a view.
The user must the implement the key expressions required by their sequence type.
Table 1.92. Key Expressions
Expression |
Result |
---|---|
sequence::template begin<Seq>::type |
The type of an iterator to the beginning of a sequence of type Seq |
sequence::template begin<Seq>::call(seq) |
An iterator to the beginning of sequence seq |
sequence::template end<Seq>::type |
The type of an iterator to the end of a sequence of type Seq |
sequence::template end<Seq>::call(seq) |
An iterator to the end of sequence seq |
sequence::template size<Seq>::type |
The size of a sequence of type Seq as an MPL Integral Constant |
sequence::template size<Seq>::call(seq) |
The size of sequence seq |
sequence::template at<Seq, N>::type |
The type of element N in a sequence of type Seq |
sequence::template at<Seq, N>::call(seq) |
Element N in sequence seq |
sequence::template value_at<Sequence, N>::type |
The type of the Nth element in a sequence of type Seq |
#include <boost/fusion/sequence/sequence_facade.hpp> #include <boost/fusion/include/sequence_facade.hpp>
A full working example using sequence_facade is provided in triple.cpp in the extension examples.