可能重复:
C++ 中带有 typedef 和模板的常量引用
请看下面的代码:
typedef wstring& RT;
RT Change(const RT v)
{
    v += L"234"; // why can I change this argument???
    return v;
}
int _tmain(int argc, _TCHAR* argv[])
{    
    wstring str = L"111";
    wstring &str2 = Change(str);
    return 0;
}
我很惊讶“更改”函数中的参数“v”可以更改。我们失去了 'const' 修饰符。诸如 std::add_const 之类的元函数没有帮助,您能解释一下这种行为吗?
工具:VS2010