using push_back to put a vector<double> into a vector<vector<double>>
<p>I have a <code>std::vector&lt;vector&lt;double&gt;&gt;</code> I want to fill in one function.
I need to store some 3 dimensional coordinates for some calculations later in my program.</p>

<p>My Question is if I do this:</p>

<pre><code>//in classdefinition
std::vector&lt;std::vector&lt;double&gt;&gt; data;

    myFunc()
    {
        std::vector&lt;double&gt; temp;
        temp.push_back(1);
        temp.push_back(2);
        temp.push_back(3);
        data.push_back(temp);

        temp.clear();
        //new data
        temp.push_back(2);
        temp.push_back(3);
        temp.push_back(4);
        data.push_back(temp);
    }
</code></pre>

<p>will the clearing and refilling of temp influence the values in data?</p>

<p>I already found this <a href="http://www.cplusplus.com/reference/vector/vector/push_back/" rel="nofollow">http://www.cplusplus.com/reference/vector/vector/push_back/</a>
but since the explanation reads "The content of val is copied (or moved) to the new element." I don't know what to think. To me this sounds like a contradiction.</p>

<p>I think it would not make much sense if the variables are passed as a reference since they can, like in my case, only be valid in a limited scope.
Am I right with my assumption?</p>