Why STL containers are preferred over MFC containers?

后端 未结 13 1720
时光说笑
时光说笑 2021-01-30 22:24

Previously, I used to use MFC collection classes such CArray and CMap. After a while I switched to STL containers and have been using them for a while.

13条回答
  •  没有蜡笔的小新
    2021-01-30 22:34

    This is a case of whichever tools work for the job you want to do, and 'better' being a subjective term.

    If you need to use your containers with other standards-compliant code, or if it is ever going to be code that is shared across platforms, STL containers are probably a better bet.

    If you're certain that your code will remain in MFC-land, and MFC containers work for you, why not continue to use them?

    STL containers aren't inherently better than MFC containers, however as they are part of the standard they are more useful in a wider range of contexts.

提交回复
热议问题