Is it possible to defer member initialization to the constructor body?

后端 未结 8 607
一生所求
一生所求 2021-01-13 14:25

I have a class with an object as a member which doesn\'t have a default constructor. I\'d like to initialize this member in the constructor, but it seems that in C++ I can\'

8条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 14:35

    I think that's one possible use case for boost::optional.

提交回复
热议问题