Generic operations on C++ containers

前端 未结 3 1913
旧巷少年郎
旧巷少年郎 2021-02-13 23:54

How to write generic operations on C++ STL containers? For example, Java has Collection interface, which every Java containers (except for maps) implements. I can do operations

3条回答
  •  说谎
    说谎 (楼主)
    2021-02-14 00:20

    C++ has std::inserter and friends to add elements to a container in a generic way. They are in the header file iterator.

提交回复
热议问题