Pointers to elements of std::vector and std::list

后端 未结 7 890
借酒劲吻你
借酒劲吻你 2020-12-05 06:56

I\'m having a std::vector with elements of some class ClassA. Additionally I want to create an index using a std::map

7条回答
  •  Happy的楠姐
    2020-12-05 07:33

    From one of the comments to another answer, it seems as if all that you want is centralize (ease) memory management. If that is really the case, you should consider using prepackaged solutions like the boost pointer container library and keep your own code as simple as possible.

    In particular, take a look at ptr_map

提交回复
热议问题