title: (Re)named std::pair members
body: <p>Instead of writing <code>town-&gt;first</code> I would like to write <code>town-&gt;name</code>. Inline named accessors (<a href="https://stackoverflow.com/q/1500064/341970">Renaming first and second of a map iterator</a> and <a href="http://compgroups.net/comp.lang.c++.moderated/Named-std-pair-members" rel="noreferrer">Named std::pair members</a>) are the best solutions I have found so far. My problem with named accessors is the loss of type safety:
  <code>pair&lt;int,double&gt;</code> may refer to <code>struct { int index; double value; }</code> or to <code>struct { int population; double avg_temp; }</code>. Can anyone propose a simple approach, perhaps something similar to traits?</p>
  
  <p>I often want to return a pair or a tuple from a function and it is quite tiring to introduce a new type like <code>struct city { string name; int zipcode; }</code> and its ctor every time. I am thrilled to learn about boost and C++0x but I need a pure C++03 solution without boost.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Re andrewdski's question: yes, a (hypothetical) syntax like <code>pair&lt;int=index, double=value&gt;</code> which would create a distinct type from <code>pair&lt;int=population, double=avg_temp&gt;</code> would meet your requirement. I do not even mind having to implement a custom pair/tuple template class ONCE and just passing a 'name traits' template argument to it approprietly when I need a new type. I have no idea how that 'name traits' would look like. Maybe it's impossible.</p>