Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards


Sequence Facade


The sequence_facade template provides an intrusive mechanism for producing a conforming Fusion sequence.

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 implement the key expressions required by their sequence type.

Table 1.106. Parameters



sequence, Seq

A type derived from sequence_facade


An MPL Integral Constant

Table 1.107. Key Expressions



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 empty<Seq>::type

Returns mpl::true_ if Seq has zero elements, mpl::false_ otherwise.

sequence::template empty<Seq>::call

Returns a type convertible to bool that evaluates to true if the sequence is empty, else, evaluates to false.

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.