Difference between revisions of "CPP/unique ptr"
From ProgrammingExamples
< CPP
Daviddoria (Talk | contribs) (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 <…') |
(→unique_ptr.cpp) |
||
Line 1: | Line 1: | ||
− | == | + | ==unique_ptr.cpp== |
<source lang="cpp"> | <source lang="cpp"> | ||
#include <iostream> | #include <iostream> | ||
Line 8: | Line 8: | ||
{ | { | ||
− | std:: | + | std::unique_ptr<int> myInt(new int); |
*myInt = 5; | *myInt = 5; | ||
Revision as of 10:14, 6 April 2011
unique_ptr.cpp
#include <iostream> #include <memory> int main(int argc, char *argv[]) { std::unique_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)