Uninitialized constant members in classes

前端 未结 3 584
心在旅途
心在旅途 2021-01-04 17:50

This is probably a ridiculously easy question, but I\'ve been searching around for the answer for a while yet can\'t seem to figure this out. I\'m trying to initialize a con

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-04 18:22

    Your code works for me (MSVC2010) - as I believe it should. What compiler are you trying this with?
    The only complaint a compiler may/should have with the code is a warning that the automatic copy constructor and assignment operator cannot be created because of the const member.

提交回复
热议问题