
Larry Evans wrote:
On 04/26/2005 05:22 PM, Giovanni P. Deretta wrote: [snip]
Agreed, but the indexed get works just as well when the argument is an enumerator instead of a literal unsigned, and when it's an enumerator, the meaning is clearer:
t.get<0>(); t.get<1>();
is obviously not as clear as:
t.get<first_field>(); t.get<second_field>();
[snip]
Well, i actually believe the first to be clearer. It is a matter of taste though.
I hope you didn't misinterpret what I was saying. I used 'first_field' and 'second_field' to emphasize the use of names instead of numbers. In a real application, the names would, of course, indicate the type of relationship. E.g. in an employee record, the enumerators would be:
enum employee_fields { name , salary , title };
Actually I did :-) In that paragraph i was talking about homogeneous tuples and i thought you were too in your answer. It is much more clearer now.
which, I hope you'll agree would make the meaning of:
a_employee.get<name>(); a_employee.get<salary>();
clearer than:
a_employee.get<0>(); a_employee.get<1>();
Yes, certanly. -- Giovanni P. Deretta