From f2542611b0758c88c1844787a0d8c0d77549bf0f Mon Sep 17 00:00:00 2001 From: Wankupi <2893353848@qq.com> Date: Mon, 26 Feb 2024 11:07:02 +0800 Subject: [PATCH] fix(vector): bugs of template pair --- vector/src/utility.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/src/utility.hpp b/vector/src/utility.hpp index 4d13ee5..aa895ab 100644 --- a/vector/src/utility.hpp +++ b/vector/src/utility.hpp @@ -15,11 +15,11 @@ public: pair(pair &&other) = default; pair(const T1 &x, const T2 &y) : first(x), second(y) {} template - pair(U1 &&x, U2 &&y) : first(x), second(y) {} + pair(U1 &&x, U2 &&y) : first(std::forward(x)), second(std::forward(y)) {} template pair(const pair &other) : first(other.first), second(other.second) {} template - pair(pair &&other) : first(other.first), second(other.second) {} + pair(pair &&other) : first(std::move(other.first)), second(std::move(other.second)) {} }; }