Reputation: 1
I'm forming a very primitive hash table. How do I create a vector where each individual index can lengthen into its own list? Is it as simple as, for example, vector<list<int>>
?
Also, if I want each node of the linked list to hold two datatypes (i.e. a string word and the integer line numbers of the file it can be found in), is it possible? I imagine not.
Upvotes: 0
Views: 895
Reputation: 1445
vecotr<list<int> >
seems fine to me.
For you second question, you can use
typedef std::pair<std::string, int> Item;
std::vector<std::list<Item> >
Upvotes: 2