using = to trigger the call of copy constructor

This commit is contained in:
Jidong Xiao
2023-09-14 18:15:16 -04:00
parent 32f60bab51
commit 836a63f8f1
2 changed files with 2 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ class Solution {
public:
vector<int> getConcatenation(vector<int>& nums) {
// use the copy constructor
vector<int> ans(nums);
vector<int> ans = nums;
int size = nums.size();
// copy the second half
for(int i=0;i<size;i++){