#include #include #include #include using namespace std; class FooT{ public: FooT(int n){ cout << n << endl; } }; const int SIZE = 10; int main() { unique_ptr foo; foo = make_unique(3); // an example of just a pointer. unique_ptr word; word = make_unique("Hello World"); word = make_unique(); *word = "Hello To You"; cout << "the word is " << *word << endl; cout << "The size of the word is " << word->size() << endl; cout << endl; // an array example unique_ptr ints = make_unique(SIZE); int i = 0; for(auto x : {1,2,3,4,5,6,7,8,9,10}) { ints[i++] = x; } for(i=SIZE-1; i > 0; i--) { cout < otherWord; cout << "Before the move " << endl; cout << " The address of word " << word.get() << endl; cout << " The address of otherword " << otherWord.get() << endl; //otherWord = word; otherWord = move(word); cout << "After the move " << endl; cout << " The address of word " << word.get() << endl; cout << " The address of otherword " << otherWord.get() << endl; return 0; }