This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
tuple_cat should be a single variadic signatureSection: 22.4.5 [tuple.creation] Status: C++11 Submitter: BSI Opened: 2010-08-25 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [tuple.creation].
View all issues with C++11 status.
Discussion:
Addresses GB-88
The tuple_cat template consists of four overloads and that
can concatenate only two tuples. A single variadic
signature that can concatenate an arbitrary number of
tuples would be preferred.
[ Resolution proposed by ballot comment: ]
Adopt a simplified form of the proposal in n2975, restricted to
tuples and neither requiring nor outlawing support for othertuple-like types.
[ 2010 Rapperswil: Alisdair to provide wording. ]
[ 2010-11-06: Daniel comments and proposes some alternative wording: ]
There are some problems in the wording: First, even though the result type tuple<see below>
implies it, the specification of the contained tuple element types is missing. Second, the term "tuple
protocol" is not defined anywhere and I see no reason why this normative wording should not be a non-normative
note. We could at least give a better approximation, maybe "tuple-like protocol" as indicated from header
<utility> synopsis. Further, it seems to me that the effects need to contain a combination of std::forward
with the call of get. Finally I suggest to replace the requirements Move/CopyConstructible
by proper usage of is_constructible, as indicated by n3140.
[ 2010 Batavia ]
Moved to Ready with Daniel's improved wording.
Proposed resolution:
Note: This alternate proposed resolution works only if 1191(i) has been accepted.
<tuple> synopsis, as indicated:
namespace std {
...
// 20.4.2.4, tuple creation functions:
const unspecified ignore;
template <class... Types>
tuple<VTypes...> make_tuple(Types&&...);
template <class... Types>
tuple<ATypes...> forward_as_tuple(Types&&...);
template<class... Types>
tuple<Types&...> tie(Types&...);
template <class... TTypes, class... UTypes>
tuple<TTypes..., UTypes...> tuple_cat(const tuple<TTypes...>&, const tuple<UTypes...>&);
template <class... TTypes, class... UTypes>
tuple<TTypes..., UTypes...> tuple_cat(tuple<TTypes...>&&, const tuple<UTypes...>&);
template <class... TTypes, class... UTypes>
tuple<TTypes..., UTypes...> tuple_cat(const tuple<TTypes...>&, tuple<UTypes...>&&);
template <class... TTypes, class... UTypes>
tuple<TTypes..., UTypes...> tuple_cat(tuple<TTypes...>&&, tuple<UTypes...>&&);
template <class... Tuples>
tuple<CTypes...> tuple_cat(Tuples&&...);
...
template <class... TTypes, class... UTypes> tuple<TTypes..., UTypes...> tuple_cat(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
8 Requires: All the types inTTypesshall beCopyConstructible(Table 35). All the types inUTypesshall beCopyConstructible(Table 35).
9 Returns: Atupleobject constructed by copy constructing its firstsizeof...(TTypes)elements from the corresponding elements oftand copy constructing its lastsizeof...(UTypes)elements from the corresponding elements ofu.template <class... TTypes, class... UTypes> tuple<TTypes..., UTypes...> tuple_cat(tuple<TTypes...>&& t, const tuple<UTypes...>& u);
10 Requires: All the types inTTypesshall beMoveConstructible(Table 34). All the types inUTypesshall beCopyConstructible(Table 35).
11 Returns: Atupleobject constructed by move constructing its firstsizeof...(TTypes)elements from the corresponding elements oftand copy constructing its lastsizeof...(UTypes)elements from the corresponding elements ofu.template <class... TTypes, class... UTypes> tuple<TTypes..., UTypes...> tuple_cat(const tuple<TTypes...>& t, tuple<UTypes...>&& u);
12 Requires: All the types inTTypesshall beCopyConstructible(Table 35). All the types inUTypesshall beMoveConstructible(Table 34).
13 Returns: Atupleobject constructed by copy constructing its firstsizeof...(TTypes)elements from the corresponding elements oftand move constructing its lastsizeof...(UTypes)elements from the corresponding elements ofu.template <class... TTypes, class... UTypes> tuple<TTypes..., UTypes...> tuple_cat(tuple<TTypes...>&& t, tuple<UTypes...>&& u);
14 Requires: All the types inTTypesshall beMoveConstructible(Table 34). All the types inUTypesshall beMoveConstructible(Table 34).
15 Returns: Atupleobject constructed by move constructing its firstsizeof...(TTypes)elements from the corresponding elements oftand move constructing its lastsizeof...(UTypes)elements from the corresponding elements ofu.template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls);8 Let
Tibe theith type inTuples,Uiberemove_reference<Ti>::type, andtpibe theith parameter in the function parameter packtpls, where all indexing is zero-based in the following paragraphs of this sub-clause [tuple.creation].9 Requires: For all
i,Uishall be the type cvituple<Argsi...>, where cviis the (possibly empty)ith cv-qualifier-seq, andArgsiis the parameter pack representing the element types inUi. LetAikbe thekith type inArgsi, then for allAikthe following requirements shall be satisfied: IfTiis deduced as an lvalue reference type, thenis_constructible<Aik, cvi Aik&>::value == true, otherwiseis_constructible<Aik, cvi Aik&&>::value == true.10 Remarks: The types in
CTypesshall be equal to the ordered sequence of the expanded typesArgs0..., Args1..., Argsn-1..., wherenequalssizeof...(Tuples). Letei...be theith ordered sequence of tuple elements of the resulttupleobject corresponding to the type sequenceArgsi.11 Returns: A
tupleobject constructed by initializing thekith type elementeikinei...withget<ki>(std::forward<Ti>(tpi))for each validkiand each element groupeiin order.12 [Note: An implementation may support additional types in the parameter pack
Tuples, such aspairandarraythat support thetuple-like protocol. — end note]