diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-31 16:02:00 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-08-02 17:22:50 +0430 |
commit | a08870cc192ebf32583df61090a87af65480a82c (patch) | |
tree | 3e29d5d27d7a5cb1eaafc6c59564b389470c5abb | |
parent | 17505ea5d9f641633335f3d6dad8c8a6c6e16638 (diff) | |
download | serenity-a08870cc192ebf32583df61090a87af65480a82c.zip |
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).
-rw-r--r-- | AK/Tuple.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/AK/Tuple.h b/AK/Tuple.h index 86793ab92e..9bdec66f15 100644 --- a/AK/Tuple.h +++ b/AK/Tuple.h @@ -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)) { } |