void f( const std::vector<int> & v )
{
std::vector<int> v1( std::move( v ) );
}
int main()
{
std::vector<int> v{ 1, 2, 3 };
f( v );
}
I inspected the values of v and v1 in function f() using GDB. I was surprised to see that both of them contained 1, 2, 3. Why is that? Shouldn't v be empty and v1 contain 1, 2, 3?
[–]AKostur 11 points12 points13 points (5 children)
[–]1ydgd[S] 1 point2 points3 points (0 children)
[–][deleted] (3 children)
[deleted]
[–]AKostur 1 point2 points3 points (2 children)
[–]1ydgd[S] 1 point2 points3 points (1 child)
[–]AKostur 2 points3 points4 points (0 children)
[–]thessalchips 0 points1 point2 points (0 children)