Why STL containers are preferred over MFC containers?

后端 未结 13 1614
时光说笑
时光说笑 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:50

    I always prefer using more standard/compatible libraries where I can since I may have future projects that I can reuse a portion of the code on. I have no idea what libraries future projects will use, but I have a better chance of making my code reusable if I use standard/compatible stuff.

    Also, the more I use a library, I get more comfortable and quicker with it. If I am going to invest the time to learn a library, I want to make sure it's going to stay around and is not tied in with a specific platform or framework.

    Of course, I say all of this assuming that my choices are rather similar when it comes to performance, features and ease of use. For instance, if the MFC classes are a significant enough improvement in these areas, I would use them instead.

提交回复
热议问题