Boost logo

Boost :

From: Alexander Nasonov (alnsn-mycop_at_[hidden])
Date: 2004-04-24 08:21:31

For the purpose of forward declaration of class templates this read-only
lightweight sequence might be useful. For example, one might declare class
template Selector in fwd file:

// empty_sequence.hpp is designed for inclusion into fwd files
#include <boost/mpl/empty_sequence.hpp>

template<class Variants = empty_sequence>
class Selector;

Another way to archieve this could be inclusion of
<boost/mpl/vector_fwd.hpp> (why there is no such file in mpl?) and using
mpl::vector<> instead. Although, it could extend a set of class templates
with those modifying template parameter but a user would find it strange to
include <boost/mpl/vector.hpp> if he only uses Selector<>.

The empty_sequence definition is as simple as:

namespace boost { namespace mpl {

namespace aux {

struct empty_sequence_iter
   typedef forward_iterator_tag category;


struct empty_sequence
  typedef aux::empty_sequence_iter begin;
  typedef aux::empty_sequence_iter end;


This is not yet complete. I hope that support for some transformations will
be added later (transformation doesn't change empty_sequence unless the
size is changed)

Alexander Nasonov
Independent Developer and Consultant

Boost list run by bdawes at, gregod at, cpdaniel at, john at