C++11 universal initialization cause unexpected initialization?

后端 未结 1 2109
醉梦人生
醉梦人生 2021-02-19 03:16

In C++ 11, The new universal initialization syntax can also be used to call a normal constructor (that doesn\'t take a initializer_list parameter). While by looking it is not ba

相关标签:
1条回答
  • 2021-02-19 04:07

    The real problem is that the API changed.

    If the constructor was

    Foo(int size, int value);
    

    and you used

    Foo foo(10, 2);
    

    and the API would have been changed to

    Foo(int value, int size);
    

    you would have the same problem.

    0 讨论(0)
提交回复
热议问题