A query about push_back and pop_front

In reply to zz8318:

You need clone to avoid pushing the handlers which point to the same object to queue.
For example:


sim_queue.push_back(tr);
sim_queue.push_back(tr);
sim_queue.push_back(tr);

This code pushes 3 handlers (tr) to sim_queue. If you don’t new/create the object before calling ap.write(), then these handlers are pointing to the same object, when you change one of them, the others will be changed also.