I am reading Effective modern C++ from Scott Meyers. Item 1 contains the following example:
template<typename T>
void f(T& param); // param is a reference
int x = 27; // x is an int
const int cx = x; // cx is a const int
f(cx); // T is const int,
// param's type is const int&
In Item 3 appears the following example:
Widget w;
const Widget& cw = w;
auto myWidget1 = cw; // auto type deduction:
// myWidget1's type is Widget
Based on Item 1 I expected myWidget1
's type to be const Widget
. Am I missing something?