Skip to content

Commit

Permalink
fix #153: 翻译错误 (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
suyeguanxing authored Nov 8, 2024
1 parent 252b63a commit 3e1e3e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/1.DeducingTypes/item3.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ std::deque<int> d;
authAndAccess(d, 5) = 10; //认证用户,返回d[5],
//然后把10赋值给它
//无法通过编译器
//无法通过编译
````
在这里`d[5]`本该返回一个`int&`,但是模板类型推导会剥去引用的部分,因此产生了`int`返回类型。函数返回的那个`int`是一个右值,上面的代码尝试把10赋值给右值`int`,C++11禁止这样做,所以代码无法编译。

Expand Down

0 comments on commit 3e1e3e2

Please sign in to comment.