std::list is a linked list. Doubly linked.
As for hash table, how are you planning on using this structure? Show us some usage scenario's and maybe we can suggest something that will work well.
#include <list> // list class-template definition
using namespace std;
class Node
{
CString string1;
CString string2;
}
list<Node> MyList;
Yeah, I was aware of the SGI hash_map, but didn't want to suggest something that's not included by default. And yes, a map or multi_map would work well if you need to store key-value pairs.NetRyder: the STL implementation from SGI does include an hash_map:
http://www.sgi.com/tech/stl/hash_map.html
However it is not included in all of the current compilers available. Which is why I was requesting more info.
However, if you need something that functions a lot like that, and it has to be standard C++, check out http://www.sgi.com/tech/stl/Map.html
You would then create an instance of Node and pass it in as an argument to MyList.push_front() or MyList.push_back(), depending on whether you want the node to be added to the head or tail end of the list.This is all I have thus far:
Now, how would one add a new node and "push" it into the list?Code:#include <list> // list class-template definition using namespace std; class Node { CString string1; CString string2; } list<Node> MyList;