阅读背景:

使用()或{}在现代c++ (c++ 11及以上)中正确地初始化变量?

来源:互联网 

The C++ reference pages say that () is for value initialisation, {} is for value and aggregate and list initialisation. So, if I just want value initialisation, which one do I use? () or {}? I'm asking because in the book "A Tour of C++" by Bjarne himself, he seems to prefer using {}, even for value initialisation (see for example pages 6 and 7), and so I thought it was good practice to always use {}, even for value initialisation. say that () is for valu




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: