is this possible with tuples in c++0x ?

8 May
2009
8 May
'09
6:37 p.m.
template <typename... Types> class tuple ... { template <typename N> auto operator[](std::size_t n = N) -> constexpr decltype(get<N>(*this)) { return get<N>(*this); } }; If this is possible, you could do (and it would be way more natural than get<3>(t)): tuple<int, float, float, string, mytype> t; t[3] = "hello"; But I feel this is not legal because of parameter std::size_t :(.

8 May
8 May
7:27 p.m.
Germán Diago escribió:
If this is possible, you could do (and it would be way more natural than get<3>(t)):
tuple<int, float, float, string, mytype> t;
t[3] = "hello";
You could achieve something similar in C++03 using placeholders. And you'd use it like this t[_3] = "hello"; Agustín K-ballo Bergé.-
5885
Age (days ago)
5885
Last active (days ago)
1 comments
2 participants
participants (2)
-
Agustín K-ballo Bergé
-
Germán Diago