Excuse me, if I'm repeating a question, but I do not find the same. What are right actions to extract an element from the standard queue?
T Pop ()
{ T rout;
EnterCriticalSection (pCSection);
rout = Queue.front (); // here the link is returned
Queue.pop (); // here destructor is called
LeaveCriticalSection (pCSection);
return rout; // -->> there everything falls
}
I have a class T
with dynamic memory management and copy constructor, in the line with front()
the copy constructor is not called automatically.
Destructor frees the memory at the end of the scope, and I have the entity with garbage.
How can I force the copy constr?