boost::tuple
has a get()
member function used like this:
tuple<int, string, string> t(5, "foo", "bar");
cout << t.get<1>(); // outputs "foo"
It seems the C++0x std::tuple
does not have this member function, and you have to instead use the non-member function form:
std::get<1>(t);
which to me looks uglier.
Is there any particular reason why std::tuple
doesn't have the member function? Or is it just my implementation (GCC 4.4)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…