Created on 2009-08-18.00:00:00 last changed 162 months ago
Proposed resolution:
Add the following signature to p2 [tuple.general]
template <size_t I, class ... Types> typename tuple_element<I, tuple<Types...> >::type&& get(tuple<Types...> &&);
And again to [tuple.elem].
template <size_t I, class ... Types> typename tuple_element<I, tuple<Types...> >::type&& get(tuple<Types...>&& t);Effects: Equivalent to return std::forward<typename tuple_element<I, tuple<Types...> >::type&&>(get<I>(t));
[Note: If a T in Types is some reference type X&, the return type is X&, not X&&. However, if the element type is non-reference type T, the return type is T&&. — end note]
Add the following signature to p1 [utility]
template <size_t I, class T1, class T2> typename tuple_element<I, pair<T1,T2> >::type&& get(pair<T1, T2>&&);
And to p5 [pair.astuple]
template <size_t I, class T1, class T2> typename tuple_element<I, pair<T1,T2> >::type&& get(pair<T1, T2>&& p);Returns: If I == 0 returns std::forward<T1&&>(p.first); if I == 1 returns std::forward<T2&&>(p.second); otherwise the program is ill-formed.
Throws: Nothing.
Add the following signature to [sequences] <array> synopsis
template <size_t I, class T, size_t N> T&& get(array<T,N> &&);
And after p8 [array.tuple]
template <size_t I, class T, size_t N> T&& get(array<T,N> && a);Effects: Equivalent to return std::move(get<I>(a));
[ Adopted at 2010-11 Batavia ]
[ 2010 Rapperswil: ]
Note that wording has been provided, and this issue becomes more important now that we have added a function to support forwarding argument lists as tuples. Move to Tentatively Ready.
[ 2009-10-30 Alisdair adds: ]
The issue of rvalue overloads of get for tuple-like types was briefly discussed in Santa Cruz.
The feedback was this would be welcome, but we need full wording for the other types (pair and array) before advancing.
I suggest the issue moves to Open from New as it has been considered, feedback given, and it has not (yet) been rejected as NAD.
The tuple get API should respect rvalues. This would allow for moving a single element out of a tuple-like type.
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-08-23 20:07:26 | admin | set | status: wp -> c++11 |
2010-11-23 13:22:14 | admin | set | messages: + msg5398 |
2010-11-14 13:10:57 | admin | set | status: voting -> wp |
2010-11-08 14:14:39 | admin | set | status: ready -> voting |
2010-10-21 19:00:35 | admin | set | messages: + msg4752 |
2010-10-21 19:00:35 | admin | set | status: open -> ready |
2010-10-21 18:28:33 | admin | set | messages: + msg1080 |
2010-10-21 18:28:33 | admin | set | messages: + msg1079 |
2009-08-18 00:00:00 | admin | create |