This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
Section: 22.4.4 [tuple.tuple] Status: Resolved Submitter: Alisdair Meredith Opened: 2009-05-23 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [tuple.tuple].
View all issues with Resolved status.
Discussion:
It is not currently possible to construct tuple
literal values,
even if the elements are all literal types. This is because parameters
are passed to constructor by reference.
An alternative would be to pass all constructor arguments by value, where it is known that *all* elements are literal types. This can be determined with concepts, although note that the negative constraint really requires factoring out a separate concept, as there is no way to provide an 'any of these fails' constraint inline.
Note that we will have similar issues with pair
(and
tuple
constructors from pair
) although I am steering
clear of that class while other constructor-related issues settle.
[ 2009-10 Santa Cruz: ]
NAD EditorialResolved. Solved by N2994.
Proposed resolution:
Ammend the tuple class template declaration in 22.4.4 [tuple.tuple] as follows
Add the following concept:
auto concept AllLiteral< typename ... Types > { requires LiteralType<Types>...; }ammend the constructor
template <class... UTypes> requires AllLiteral<Types...> && Constructible<Types, UTypes>... explicit tuple(UTypes...); template <class... UTypes> requires !AllLiteral<Types...> && Constructible<Types, UTypes&&>... explicit tuple(UTypes&&...);ammend the constructor
template <class... UTypes> requires AllLiteral<Types...> && Constructible<Types, UTypes>... tuple(tuple<UTypes...>); template <class... UTypes> requires !AllLiteral<Types...> && Constructible<Types, const UTypes&>... tuple(const tuple<UTypes...>&);
Update the same signatures in 22.4.4.2 [tuple.cnstr], paras 3 and 5.