Boost logo

Boost :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-01-23 15:37:19


First of all there are several glitches here:

> template <typename _T1, int _Name1, typename _T2, int _Name2>
> class named_pair{
> public:
> template <int _Name>
> class var{};
>
     template<>?
> class var<_Name1>{

 I am not sure that you allowed to use template parameter for defining
partial specialization.
> public:
> _T1 value;
> }

;?

>
     template<>?
> class var<_Name2>{
public:
> _T2 value;
> }

;?

> };
>
> enum{ Cash, Name };
>
> void main(int argc, char *argv[]){
> named_pair<float, Cash, char*, Name> foobar;
>
> foobar.var<Cash>.value = 32.2;
> foobar.var<Name>.value = "Fred";

Even if above class definition is allowed foobar.var<Cash> will be invalud
cause var<Cash> is a type name. So basically what you are doing is unusable.

> }

Look on MPL example for inherit_linear. It may have what you need.

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk