Extending std::list

后端 未结 8 2117
小蘑菇
小蘑菇 2021-01-31 13:00

I need to use lists for my program and needed to decide if I use std::vector or std::list. The problem with vector is that there is no remove method and with list that there is

8条回答
  •  孤独总比滥情好
    2021-01-31 13:22

    In addition to other excellent comments, the best way to extend a standard container is not by derivation, but writing free functions. For instance, see how Boost String Algorithms can be used to extend std::string and other string classes.

提交回复
热议问题