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

9 May
2009
9 May
'09
12:37 a.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 :(.

9 May
9 May
1:27 a.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é.-
5901
Age (days ago)
5901
Last active (days ago)
0 comments
1 participants
participants (1)
-
Agustín K-ballo Bergé
-
Germán Diago