Created on 2009-05-23.00:00:00 last changed 170 months ago
Proposed resolution:
Ammend the tuple class template declaration in [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 [tuple.cnstr], paras 3 and 5.
[ 2009-10 Santa Cruz: ]
NAD EditorialResolved. Solved by N2994.
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-11-19 19:04:45 | admin | set | status: nad editorial -> resolved |
2010-10-21 18:28:33 | admin | set | messages: + msg801 |
2010-10-21 18:28:33 | admin | set | messages: + msg800 |
2009-05-23 00:00:00 | admin | create |