Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对 Item2 的建议:标注 auto x4{27} 语义已经变化 #152

Open
Patricky-Tau opened this issue Apr 23, 2023 · 1 comment
Open

对 Item2 的建议:标注 auto x4{27} 语义已经变化 #152

Patricky-Tau opened this issue Apr 23, 2023 · 1 comment

Comments

@Patricky-Tau
Copy link
Contributor

Patricky-Tau commented Apr 23, 2023

auto x4{27} 在书中称 auto 推导出 std::initializer_list<int>。然而,在 N3922 之后,将会推导出 int

auto x1 = {3}; // x1 is std::initializer_list<int>
auto x2{1, 2}; // error: not a single element
auto x3{3};    // x3 is int
               // (before N3922 x2 and x3 were both std::initializer_list<int>)

-- cppreference

作者的网站中也指出了这一点:

image

有许多同学用这本书入门,建议标注出这一点。


参考资料:

Patricky-Tau added a commit to Patricky-Tau/EffectiveModernCppChinese that referenced this issue Apr 26, 2023
Patricky-Tau added a commit to Patricky-Tau/EffectiveModernCppChinese that referenced this issue Apr 26, 2023
Patricky-Tau added a commit to Patricky-Tau/EffectiveModernCppChinese that referenced this issue Apr 26, 2023
@wendajiang
Copy link
Member

It's look like that you have fixed on your own repo, it's pleasure to submit the PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants