Why does nobody seem to use tuples in C++, either the Boost Tuple Library or the standard library for TR1? I have read a lot of C++ code, and very rarely do I see the use of tup
As a data-store std::tuple
has the worst characteristics of both a struct
and an array; all access is nth position based but one cannot iterate through a tuple
using a for
loop.
So if the elements in the tuple
are conceptually an array, I will use an array and if the elements are not conceptually an array, a struct (which has named elements) is more maintainable. ( a.lastname
is more explanatory than std::get<1>(a)
).
This leaves the transformation mentioned by the OP as the only viable usecase for tuples.