mirror of
https://github.com/CnTransGroup/EffectiveModernCppChinese.git
synced 2025-02-09 18:50:34 +08:00
Update item2.md
This commit is contained in:
parent
6fa21f8143
commit
4753623c99
@ -160,10 +160,10 @@ auto createInitList()
|
||||
同样在C++14的lambda函数中这样使用auto也不能通过编译:
|
||||
````cpp
|
||||
std::vector<int> v;
|
||||
...
|
||||
…
|
||||
auto resetV =
|
||||
[&v](const auto& newValue){ v = newValue; }; //C++14
|
||||
...
|
||||
…
|
||||
resetV({ 1, 2, 3 }); //错误!不能推导{ 1, 2, 3 }的类型
|
||||
````
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user