I have a question and I can't find an answer anywhere. However, there is some code I have to show:
  #include "Vector2D"
    class something
    {
        Vector2D * p_Position;
      public:
        something(){p_Position = new Vector2D;}
        ~something(){delete p_Position;}
    };
    int main()
{
    std::list<something> Somethinglist;
    Somethinglist.push_back(something());
    Somethinglist.clear();
    return 0;
}
So, this will lead to an assertion fail when it comes to the .clear() function. So I tried out a few things. First of all this code completely works if I just don't put the delete p_Position in the deconstructor. Why is that? Does the STL list .clear() function automatically destroy dynamic Pointers? Or a rather direct question: How can I fix this code?
 
     
     
     
    