-1

what's the difference between std::vector<T> const & and const std::vector<T> & ?

I'm used to const T &, but this "T const &" is different to me.

and forgive me for my ignorance.

1 Answers1

0

They are completely equal.

You can verify this by trying to compile the following code and see how the compiler complains about a redefinition:

#include <vector>

void f(std::vector<int> const &) {}
void f(const std::vector<int> &) {} // error: redefinition
Christian Hackl
  • 27,051
  • 3
  • 32
  • 62