Why do some people prefer "T const&" over "const T&"?
Posted
by Michael Aaron Safyan
on Stack Overflow
See other posts from Stack Overflow
or by Michael Aaron Safyan
Published on 2010-04-14T19:36:16Z
Indexed on
2010/04/14
19:43 UTC
Read the original article
Hit count: 252
So, I realize that const T&
and T const&
are identical and both mean a reference to a const T. In both cases, the reference is also constant (references cannot be reassigned, unlike pointers). I've observed, in my somewhat limited experience, that most C++ programmers use const T&
, but I have come across a few people who use T const&
. Is this just a personal preference? Why is one chosen over the other?
© Stack Overflow or respective owner