AK: Correct Tuple's constructor signatures

Tuple previously required rvalue references, this commit makes it accept
forwarding references instead (which was the intention all along).
This commit is contained in:
Ali Mohammad Pur 2021-07-31 16:02:00 +04:30 committed by Ali Mohammad Pur
parent 17505ea5d9
commit a08870cc19
Notes: sideshowbarker 2024-07-18 07:35:20 +09:00

View file

@ -59,15 +59,17 @@ private:
template<typename T, typename... TRest>
struct Tuple<T, TRest...> : Tuple<TRest...> {
Tuple(T&& first, TRest&&... rest)
: Tuple<TRest...>(forward<TRest>(rest)...)
, value(forward<T>(first))
template<typename FirstT, typename... RestT>
Tuple(FirstT&& first, RestT&&... rest)
: Tuple<TRest...>(forward<RestT>(rest)...)
, value(forward<FirstT>(first))
{
}
Tuple(const T& first, const TRest&... rest)
: Tuple<TRest...>(rest...)
, value(first)
Tuple(T&& first, TRest&&... rest)
: Tuple<TRest...>(move(rest)...)
, value(move(first))
{
}