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

Reply via email to