Boost logo

Boost Users :

Subject: [Boost-users] Representing of empty sequence
From: Missing Rainbow (d0253082_at_[hidden])
Date: 2008-10-13 17:50:03

Hi All,

I am trying to understand the implementation of mpl::vector. I have
simplified greatly to help understand it. I am now trying to figure
out how to represent an empty sequence. Here is what I have got:

template <class T0>
struct vector1
   typedef vector1 type;

template <class T0, class T1>
struct vector2
   typedef vector2 type;

template <class T0, class T1, class T2>
struct vector3
   typedef vector3 type;

struct dummy;

template <class T0 = dummy, class T1 = dummy, class T2 = dummy>
struct vector;

struct vector : vector1<T0> {};

template <T0, T1>
struct vector : vector2 <T0, T1> {};

template <T0, T1, T2>
struct vector : vector3 <T0, T1, T2> {};


vector2<int, long>::type
vector3<short, int, long>::type
vector<int, long>::type
vector<bool, float, double>::type

How to declare and make use of an empty sequence?


Flow:  For Love of Water

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at