add original source

This commit is contained in:
Bo Wang
2014-04-22 21:54:16 -04:00
parent f7a05be5e1
commit 6e45d14431
128 changed files with 5726 additions and 0 deletions

18
source/listing_a.2.cpp Normal file
View File

@@ -0,0 +1,18 @@
class move_only
{
std::unique_ptr<my_class> data;
public:
move_only(const move_only&) = delete;
move_only(move_only&& other):
data(std::move(other.data))
{}
move_only& operator=(const move_only&) = delete;
move_only& operator=(move_only&& other)
{
data=std::move(other.data);
return *this;
}
};
move_only m1;
move_only m2(m1);
move_only m3(std::move(m1));