DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: STL Linked List or Hash Table

Hybrid View

  1. #1
    Join Date
    Dec 2005
    Posts
    134

    STL Linked List or Hash Table

    I am not too experienced with the standard template library (STL) in C++. I am more experienced with MFC. I have heard some good things about STL. Is it ture that there is a ready-to-use linked list? Is there also a hash table?

    What advantages would there be to writing one from scratch?

    If I do go with MFC, what advantages are there?

  2. #2
    Join Date
    Nov 2003
    Posts
    4,118
    There is, but it's called "unordered_map" and it's available only if you have the latest STL implementation. Some STL implementations also offer a hash_table or hash_map container but these aren't standard names.
    Danny Kalev

  3. #3
    Join Date
    Dec 2005
    Posts
    134
    Quote Originally Posted by Danny
    There is, but it's called "unordered_map" and it's available only if you have the latest STL implementation. Some STL implementations also offer a hash_table or hash_map container but these aren't standard names.
    I am going to use the STL list. I want to have each node have two strings. Here is how far I have gotten:

    Code:
    #include <list> // list class-template definition
    
    using namespace std; 
    
    class Node
    {
       CString string1;
       CString string2;
    }
    
    
    
    list<Node> MyList;
    I would I put nodes into this list?

  4. #4
    Join Date
    Mar 2007
    Location
    Bangalore, India
    Posts
    247
    You can use the push_back (to put), pop_front (to remove), front (to retrieve without removing), and size member functions. It is best that you look up its documentation (which you can search on the internet) and use what you find appropriate.

  5. #5
    Join Date
    Mar 2007
    Location
    Bangalore, India
    Posts
    247
    Here is one source from where you can get a simple but good reference of the list methods with examples:
    http://www.cs.uregina.ca/Links/class-info/210/STLList/

    It has quite a few member functions. You may be interested in learning how to use the iterator, and insert in any position, or even to go through the list easily.

Similar Threads

  1. single linked list.. so confused...
    By zaacze in forum Java
    Replies: 3
    Last Post: 04-01-2007, 06:15 PM
  2. Replies: 12
    Last Post: 10-26-2005, 09:54 AM
  3. Access linked table from Outlook wrong info
    By Ted in forum Enterprise
    Replies: 0
    Last Post: 01-01-2002, 01:59 AM
  4. Replies: 0
    Last Post: 03-06-2001, 01:29 PM
  5. Using Inner Join with a Linked Table (Error Message).
    By Frixos Kimonis in forum ASP.NET
    Replies: 1
    Last Post: 04-27-2000, 04:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center