Thread: How to sort CArray?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    68

    How to sort CArray?

    I declare this below data.

    Code:
    CArray<unsigned char, unsigned char> m_data1, m_data2, m_data3, m_data4;
    I want to to sort m_data1, m_data2, m_data3, m_data4.
    If you know how to do that, please tell me.

    Thank you very much.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    I recommend STL over MFC for data structure.

    As for sorting a CArray object, one solution is to pass the object to a quicksort. You will have to implement the quicksort.

    Kuphryn

  3. #3
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    Quick sort is already implemented in standard library. See the qsort function.

    You will only have to implement a comparison callback function, but this is relatively straight forward.
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Straight Insertion Sort function problem
    By StaticKyle in forum C++ Programming
    Replies: 6
    Last Post: 05-12-2008, 04:03 AM
  2. threaded merge sort
    By AusTex in forum Linux Programming
    Replies: 4
    Last Post: 05-04-2005, 04:03 AM
  3. Sorting
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 11-10-2003, 05:21 PM
  4. radix sort and radix exchange sort.
    By whatman in forum C Programming
    Replies: 1
    Last Post: 07-31-2003, 12:24 PM
  5. Shell Sort vs Heap Sort vs Quick Sort
    By mackol in forum C Programming
    Replies: 6
    Last Post: 11-22-2002, 08:05 PM