Reference:
https://en.cppreference.com/w/cpp/language/function
Top-level cv-qualifiers are dropped from the parameter type (This adjustment only affects the function type, but doesn't modify the property of the parameter:
int f(const int p, decltype(p)*); and int f(int, const int*); declare the same function)
This also make function template deduction remove C.V from copy by value.
e.g
template<typename T >
void Run(T t);
const int i{42};
Run(i); // T is type of int
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.