summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-07-31 16:02:00 +0430
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-08-02 17:22:50 +0430
commita08870cc192ebf32583df61090a87af65480a82c (patch)
tree3e29d5d27d7a5cb1eaafc6c59564b389470c5abb
parent17505ea5d9f641633335f3d6dad8c8a6c6e16638 (diff)
downloadserenity-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.h14
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))
{
}