STL-error?

Started by
12 comments, last by Jedyte 20 years, 10 months ago
if this is a member function of a class then make sure the class'' object is valid.
Advertisement
Hmm, I think something's wrong in the destructor of the class.
Could it be that because I don't have an (empty) virtual destructor in a derived class, that it gives the error? In what cases is a virtual destructor needed when using polymorphism?

[edited by - Jedyte on June 4, 2003 1:03:15 PM]
And the price we paid was the price men have always paid for achieving paradise in this life -- we went soft, we lost our edge. - "Muad'Dib: Conversations" by the Princess Irulan
Usually always. Certainly any time those instances might be deleted via a pointer to a base class.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
Got it! Thanks Kylotan, your idea brought me back on track.
It was a stupid list::back() when the list was empty. Cheez, I've been programming in STL for over 4 years, you'd think I'd wouldn't make such a mistake anymore %)

To return to my other question now that we're on it, if I write this, will the destructors be called correctly?
class Base{  Base();  virtual ~Base(); // virtual here};class Derived: public Base{  Derived();  // but nothing here, we don't need it};
Thanks.

[edited by - Jedyte on June 4, 2003 1:33:20 PM]
And the price we paid was the price men have always paid for achieving paradise in this life -- we went soft, we lost our edge. - "Muad'Dib: Conversations" by the Princess Irulan

This topic is closed to new replies.

Advertisement