Boost logo

Boost :

From: Fredrik Blomqvist (fredrik_blomqvist_at_[hidden])
Date: 2003-01-23 15:30:12


This is interesting stuff, but I think you should checkout Emily Winch's
more general compile-time associative list implementation also.
(http://groups.yahoo.com/group/boost/files/alist-feb14-02.zip seems to be
the latest)

What's the status of the Emily's lib btw? Is an MPL/Boost integration under
consideration?

"Jason House" <jhouse_at_[hidden]> wrote in message
news:3E3042BD.A9111523_at_mitre.org...
> I tried to do the following implementation in visual studio 6 to see if
> I could get a named pair class.
>
> I tried a number of approaches, but none worked with my compiler. Is my
> approach fundamentally flawed?
>
> I think that something like this would be a useful utility to have.
> Anyone have any ideas on how to improve the class?
>
> ********************************
> template <typename _T1, int _Name1, typename _T2, int _Name2>
> class named_pair{
> public:
> template <int _Name>
> class var{};
>
> class var<_Name1>{
> public:
> _T1 value;
> }
>
> class var<_Name2>{
> _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";
> }
>


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