Using c++ smart pointers?

Example:


  #include 
  int main() {
      int* p = new int(10);
  }
  

Solution:


  #include 
  int main() {
      std::unique_ptr p(new int(10));
  }
  

Beginner's Guide to C++