const T& xx

Start on a new page. Following Scratchapixel to review and learn graphics. In the first lesson, a constructor

1
Vec3(const T &xx) : x(xx), y(xx), z(xx) {}

in class Vec3 is used. As a weak learner of c++, I’m confused about the parameter passing here. Why using const T &xx?
An answer on the stack overflow solved my question.

post
What’s the difference?

1
2
void DoWork(int n);
void DoWork(const int &n);

Answer:
The difference is more prominent when you are passing a big struct/class.

1
2
3
4
5
6
struct MyData {
int a,b,c,d,e,f,g,h;
long array[1234];
};
void DoWork(MyData md);
void DoWork(const MyData& md);

When you use use ‘normal’ parameter, you pass the parameter by value and hence creating a copy of the parameter you pass. if you are using const reference, you pass it by reference and the original data is not copied.
In both cases, the original data cannot be modified from inside the function.
EDIT:
In certain cases, the original data might be able to get modified as pointed out by Charles Bailey in his answer.