Quote:Original post by GPX
From my point of view, an object should never be in an "unitialized state" after construction. That's not the purpose of the constructor, its purpose is to construct the object, and bring it to an initialized state. Adding a default constructor "just for things to work", isn't reasonable.
"Uninitialized" is probably a misnomer here. A constructor should place an object in a known, consistent state which will not cause your destructor to explode, but it doesn't mean the object has to be immediately useful. The default constructor for a texture object may leave the texture "empty", requiring you to later call an initialization function to load an actual texture.
Not being able to fully initialize an object within the constructor is a commmon enough occurence. Sometimes you don't have a choice but to require a call to a post-construction initialization function.
Here, having a default constructor that creates an object using an ugly "default sprite" can be very useful.
Quote:Original post by deffer
If I get you right, you're saying that "if std::vector is using it, anybody can use it".
This is not how I read what he said. I believe he meant that since std::vector does the in-place initialization for you, there is no need to worry about whether placement new is an advanced topic or not.