[RESOLVED] MFC Collection Classes.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: [RESOLVED] MFC Collection Classes.

Threaded View

  1. #1
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,051

    [RESOLVED] MFC Collection Classes.

    One of issues that bother me in 'Visual C++' forum is when somebody open a thread like for example "I've got a question about CArray/CList/CStringArray/etc..." and often this answer comes: "Why don't you use std::vector/std::list? It's more powerfull...".

    I always said "although, theoretical there is nothing wrong, once you are using MFC, it's not a brilliant idea to mix another stuff (like STL) if it's not absolutely necessary... it makes the application harder to read, maintain, etc".
    No way to convince everybody... "std::vector has copy ctor, CArray has not, std::list have sort and other cool methods which CList has not, and blah-blah..."

    Well in an MFC real application, me personal, I don't remember a situation to be really necessary to directly sort a collection class elements. Most of these comes from a database and no sweat to add an "ORDER BY" to SQL statement.
    Or are strings needed to be ordered in a listbox/combobox, then we have LBS_SORT/CBS_SORT styles.
    Or need to sort columns in a listview control and have CListCtrl::SortItems.
    Or...
    And generally what sense has sorting (or copy ctors/assignment operators) for windows, GDI objects,...?

    BUT...
    To make STL-in-MFC-mixers, speak now or be silent forever...
    would be great if implement also in some MFC collection classes some features "borrowed" from STL. For sure CStringList::Sort, CStringArray::Sort, CUIntArray::Sort, CStringList::Unique, etc have sense and there is no sweat to be implemented.

    Moreover, since STL has no "direct" method 'vector::sort', we'll see MFC it's more powerful .
    And who knows, maybe a CAlgorithm class...
    Last edited by ovidiucucu; June 20th, 2006 at 06:17 AM.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/
    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center