I am surprised that the following simple code won\'t compile (with gcc, version 4.8.1)
#include void test() { std::string* p = new std::stri
2019 update: Starting from C++17, you can use std::destroy_at as follows:
std::destroy_at(p);
It's much simpler and follows the principle of not using "primitive constructs" (such as new / delete expressions) in modern C++.
new
delete