|
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;
template<T0>
struct vector : vector1<T0> {};
template <T0, T1>
struct vector : vector2 <T0, T1> {};
template <T0, T1, T2>
struct vector : vector3 <T0, T1, T2> {};
Examples:
vector1<char>::type
vector2<int, long>::type
vector3<short, int, long>::type
vector<char>::type
vector<int, long>::type
vector<bool, float, double>::type
How to declare and make use of an empty sequence?
Rgds,
anna
-- Flow: For Love of Water http://missingrainbow.blogspot.com/2008/09/flow-for-love-of-water.html
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net