Advice on a better way to extend C++ STL container with user-defined methods

后端 未结 8 1563
星月不相逢
星月不相逢 2020-12-01 08:41

I inherited from C++ STL container and add my own methods to it. The rationale was such that to the clients, it will look act a regular list, yet has application-specific me

8条回答
  •  借酒劲吻你
    2020-12-01 09:10

    Warnings about not inheriting from STL containers appear because methods of STL containers are not virtual. So if you don't override methods and don't need polymorphic behaviour, but just extend the class — it's OK to inherit STL containers.

提交回复
热议问题