Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Linked list storing a queue

Reply
Thread Tools

Linked list storing a queue

 
 
Kay
Guest
Posts: n/a
 
      08-31-2004
A linked list is storing several names. I want to make a queue if I
input a name that is same as the linked list. How to make each node of a
linked list storing a queue that are different with each other node, do
I need to add one more item in the ListNode OR I only call the queue
insert function to do it ?

 
Reply With Quote
 
 
 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      08-31-2004
* Kay:
> A linked list is storing several names. I want to make a queue if I
> input a name that is same as the linked list. How to make each node of a
> linked list storing a queue that are different with each other node, do
> I need to add one more item in the ListNode OR I only call the queue
> insert function to do it ?


Are you sure you really want a _list_?

A std::map seems more appropriate from what you write.

But assuming a list is indeed The Thing,

class Data...

class NameAndDataList
{
private:
struct NameAndData
{
std::string name;
Data data;
NameAndData( std::string const& s, Data const& d )
: name( s ), data( d )
{}
};

std::list< std::queue< NameAndData > > myList;

public:
...

void insert( std::string const& name; Data const& data )
{
// insertion code goes here.
}
};

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program blocked in Queue.Queue.get and Queue.Queue.put Kris Python 0 01-04-2012 03:46 PM
Linked list within a linked list joshd C++ 12 10-02-2006 08:57 AM
Linked list, New try (was:Linked list, no out put,help) fool C Programming 14 07-03-2006 12:29 AM
Is Queue.Queue.queue.clear() thread-safe? Russell Warren Python 4 06-27-2006 03:03 PM
Linked lisd storing a queue Kay C Programming 2 08-31-2004 06:16 PM



Advertisments