Re:Named tuple for C++
by shin_lao on Sunday January 03, 2016 @04:36AM
(#10830060)
You can iterate on the tuple and know it size, not on the struct (unless you use Boost.Fusion or something equivalent).
[ Parent
| on HN ]
Yeah, tuples make sense sometimes, that's why they are introduced. I think iterating through a tuple only makes sense if you store in some kind "similar" elements in there (not necessarily same type but same trait class). It could indeed be great for generic programming where your tuple have variadic length (depending on template parameters).
Just don't use it to replace structs, it doesn't make sense.