Is using std::vector< std> > an antipattern?

后端 未结 4 1421
醉话见心
醉话见心 2020-12-29 22:22

For a long time I was using std::vector and std::shared_ptr hand in hand. Recently I started using std::shared_ptr when

4条回答
  •  青春惊慌失措
    2020-12-29 23:02

    if you insist on keeping std::vector you can try to encapsulate it into a handle-body idiom structure.

    this allows you to keep a non const shared pointer in a const handle.

提交回复
热议问题