C++ - A Heap vs. Free Store question

Started by
9 comments, last by ToohrVyk 15 years, 10 months ago
Quote:Original post by loufoque
Quote:There is no possible way, in the C++ language, to call a constructor explicitly.

Of course there is. How do you think containers are implemented?
It's called placement new. You demonstrated it yourself.


Placement new is not an explicit constructor call, although it will perform an implicit constructor call as part of the initialization process.

Besides, explicitly calling a constructor would be useless anyway, since initializing an object often requires some additional steps (such as setting up a set of virtual pointers) that are not part of the constructor itself.

This topic is closed to new replies.

Advertisement