[C++-sig] How to get items from a tuple

Stefan Seefeld seefeld at sympatico.ca
Fri Jan 16 15:16:05 CET 2009

Ricardo Abreu wrote:
> Well, thank you. The problem was really that I didn't notice I had to 
> extract the int explicitly.
> About the code being too compact, I'm not sure I got what you mean, 
> unless you would want me to have a variable in between the tuple and 
> the print just to hold the result of the cast, in which case I don't 
> agree you would gain on readability - you would see a cleaner print 
> but you would have to track another variable, and I really don't think 
> that (int)t[0] is that difficult to understand.
I'm not saying the code itself is too compact. My point was that often 
there is a lot going on in the evaluation of a single expression. As 
long as all works fine, that's good, but when something fails it might 
be a good idea to dissect the statement to see what is actually 
happening, step by step.



      ...ich hab' noch einen Koffer in Berlin...

More information about the Cplusplus-sig mailing list