For example, we have a function like that:
template <typename TYPE>
void construct_and_destruct(TYPE & object)
{
//...
}
We cant call constructor and destructor like object.Type() and object.~Type() (no true now) ( Whyy? =C )
To call the constructor we can like new(&object) TYPE(). And I dont know how to call destructor (no exist placement delete). How to do this?
You can call the destructor as:
but it’s likely not what you want, and are subject to a double delete.
The constructor is as simple as: