sorry in advance if this question is quite incomplete, unclear or a duplicate (it's my first one here). While studying move semantics and working on a small project for my OOP course I stumbled upon a question that I can't answer myself. As far as I know std::move() works by converting l-values into r values, but let's suppose we were moving a vector with a lot of elements into a second vector that has a capacity of 1. Could I use reserve() to avoid a lot of automatic memory re-allocations of the second vector or would using reserve() have no effect due to std::move() moving r-values into the second vector? A simple realization of my question can be found below.
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<int> first (1000000);
std::vector<int> second (1);
std::fill(first.begin(),first.end(),7);
second.reserve(1000000);//is this needed??
second=std::move(first);
return 0;
}