C++ STL Vector: Push_back taking reference

Viewed 9464

From the cpp documentation for std::vector, I see this:

void push_back ( const T& x );

I understand that push_back makes a copy of the object that I pass. But, why is the signature const T& ? By looking at this, I initially thought it takes a const reference of whatever object that I push to the vector.

3 Answers
Related