Basic usage of unique_ptr and custom free of it

#include <Windows.h>   #include <iostream> #include <memory>   #pragma comment(lib, "Shell32.lib") using namespace std;   class MyClass { public: MyClass() { cout << "ctor" << endl; } ~MyClass() { cout << "dtor" << endl; } };   int main() { { // basic unique_ptr<MyClass> p1(new MyClass); unique_ptr<MyClass> p2 = make_unique<MyClass>(); }   { int* pI… Continue reading Basic usage of unique_ptr and custom free of it

Published
Categorized as C++ Tagged