Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. STL, or MFC's Array/List?

STL, or MFC's Array/List?

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structuresquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    code_discuss
    wrote on last edited by
    #1

    I'm a Windows programmer and use MFC heavily. But in many forum/newsgroup STL seems to be a must have for a c++ programmer. So I'm curious that should I use STL or MFC's array/list in my project? STL seems to be a standard, but MFC's array/list fit in the MFC structure well.

    C R 2 Replies Last reply
    0
    • C code_discuss

      I'm a Windows programmer and use MFC heavily. But in many forum/newsgroup STL seems to be a must have for a c++ programmer. So I'm curious that should I use STL or MFC's array/list in my project? STL seems to be a standard, but MFC's array/list fit in the MFC structure well.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      MFC containers are crap, they were a stopgap until they had STL in their compiler, and remained as a legacy support thing. They should never be used unless you have a compelling reason, you should use STL by default.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • C code_discuss

        I'm a Windows programmer and use MFC heavily. But in many forum/newsgroup STL seems to be a must have for a c++ programmer. So I'm curious that should I use STL or MFC's array/list in my project? STL seems to be a standard, but MFC's array/list fit in the MFC structure well.

        R Offline
        R Offline
        Rajith
        wrote on last edited by
        #3

        Here are some performance readings which i took for CArray and std::vector Time taken to add 1 million elements( unsigned long ) CArray = 2.7360s ( 2736 ms ) //Will be faster if you set the size using SetSize() vector = 0.0210s ( 21 ms ) //Will be faster if you set the size using reserve() CList = 0.0260s ( 26 ms ) std::list = 0.1220 ( 122 ms ) CMap = 0.0820 ( 82 ms ) // Used InitHashTable( 200017 ) or else it will take ages to add elements stl::map = 0.0399 ( 399 ms ) Though STL is not as well structured or as easy to use as MFC but performance wise they win hands down. Note: Will using STL access the elements using iterators. It will be very fast.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups