vector of pointers

what is the consquences if i didnt allocate the vectors of pointers in the heap properly
like this
1
2
3
4
5
6
7
8
9
10
11
12
13
class Test
{
  public:
  Test()
     :m_test(); // i did not use new so i didnt allocate it properly
  {
     m_test.push_back(Class()); // did not allocate properly but i still use it
  }
  
  private:
  std::vector<Class*> m_test;

}
The objects will remain allocated on the heap. The actual effect will depend on what the object is.
> m_test.push_back(Class()); // did not allocate properly but i still use it

It won't compile. Class() is an anonymous value of type Class; m_test.push_back() expects a pointer.
why did you report JLBorges?
Topic archived. No new replies allowed.