Boost Users :
Subject: [Boost-users] Tips on implementing a function queue with unique queue items (compare function problem)
From: Peter Åberg (aberg_at_[hidden])
Date: 2009-05-12 08:46:26
Anyone have a tip or pointer regarding how to implement a function queue
with unique items?
Comparing C++ delegates seems to be hard in general
but there are probably workarounds that are alright. It would be nice of
course if the queue user stays unaffected by the workaround but that is
probably not possible. Another layer perhaps.
Any suggestion for the code below?
typedef boost::function<void()> QueueItem;
void push(QueueItem item)
/* ToDo, would be nice to do:
if (item is already in the queue)
for(std::deque<QueueItem>::iterator i = queue.begin(); i !=
queue.push(boost::bind(&Synchronizer::sync, &synchronizer, LeftToRight));
queue.push(boost::bind(&Synchronizer::sync, &synchronizer, RightToLeft));
LeftToRight)); // Should not be added since there is one in the queue
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net