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" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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"; > } > _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost