I've been searching but couldn't find an answer to this. Is there a way to tell the new
operator to not call the class constructors?
MyObject* array = new MyObject[1000];
This will call MyObject()
a thousand times! I want to fill the allocated memory myself and do not need any information initialized in the constructor. Using malloc()
is not very harmonic C++ code imho.
MyObject* array = (MyObject*) malloc(sizeof(MyObject) * 1000);