using std::unique_ptr with allocators
问题 I was trying my hand with allocators this time & felt that there were many chances of leaking the resources. So I thought what if I used std::unique_ptr to handle them. I tried my hand with a std::vector 's allocator. My code goes like this :- // allocator #include <iostream> #include <vector> #include <memory> using namespace std; class X { int x,ID; static int i; public: X() { cout<<"constructing "; ID=++i; cout<<"ID="<<ID<<'\n'; } X(int a) { x=a; cout<<"constructing "; ID=++i; cout<<"ID="<