Difference between revisions of "CPP/unique ptr"

From ProgrammingExamples
< CPP
Jump to: navigation, search
(Created page with '==auto_ptr.cpp== <source lang="cpp"> #include <iostream> #include <memory> int main(int argc, char *argv[]) { std::auto_ptr<int> myInt(new int); *myInt = 5; std::cout <…')
(No difference)

Revision as of 15:20, 13 March 2011

auto_ptr.cpp

#include <iostream>
#include <memory>
 
 
int main(int argc, char *argv[])
{
 
  std::auto_ptr<int> myInt(new int);
  *myInt = 5;
 
  std::cout << *myInt << std::endl;
 
  return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(auto_ptr)
ADD_EXECUTABLE(auto_ptr auto_ptr.cpp)