Say I have this function:
vector<int> func(vector<int>& a) {
    vector<int> res;
    for (int x : a) {
        res.push_back(a*2);
    }
    return res;
}
As far as I'm aware, when func returns, res is copied onto the stack which basically repeats an O(n) operation. Does C++ have capabilities to return a vector here without copying the entire thing ?
