The ptr constructors works with plain data but fails with objects:
#include <string>
#include <memory>
struct MyClass{};
int main() {
std::unique_ptr<int> ptr(new int(5));
std::unique_ptr<std::string> ptr1(new std::string("string")); //function 'ptr1' could not be resolved.
std::unique_ptr<MyClass> ptr2(new MyClass); //unction 'ptr2' could not be resolved.
return 0;
}
why?
My g++ version is (Ubuntu/Linaro 4.7.3-2ubuntu1~12.04) 4.7.3