C++ default initialization and value initialization: which is which, which is called when and how to reliably initialize a template-type member

前端 未结 2 990
死守一世寂寞
死守一世寂寞 2020-12-13 00:34

My question somewhat overlaps with this and several other similar ones. Those have some great answers, but I\'ve read them and I\'m still confused, so please don\'t consider

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 01:25

    Yes, A inst4 (); is treated as a function declaration. std::string str(); should be the same (i.e. I think you mistakenly thought it worked).

    Apparently (from here), C++03 will have inst3._a be 0, but C++98 would have left it uninitialized.

提交回复
热议问题