Commit 196a8e9fb5824e2704a65e6592466c7f945bba81
1 parent
a7b17ae1
Added -fno-elide-constructors to makefile
Showing
2 changed files
with
5 additions
and
2 deletions
examples07/04-unique_ptr/02-move.cpp
| ... | ... | @@ -9,12 +9,14 @@ class Example |
| 9 | 9 | Example(Example&& rhs) : val(rhs.val) |
| 10 | 10 | { |
| 11 | 11 | rhs.val = nullptr; |
| 12 | + std::cout << "Example::Example(Example &&)" << std::endl; | |
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | Example& operator=(Example&& rhs) |
| 15 | 16 | { |
| 16 | 17 | val = rhs.val; |
| 17 | 18 | rhs.val = nullptr; |
| 19 | + std::cout << "Example::operator=(Example &&)" << std::endl; | |
| 18 | 20 | return *this; |
| 19 | 21 | } |
| 20 | 22 | |
| ... | ... | @@ -39,7 +41,6 @@ class Example |
| 39 | 41 | |
| 40 | 42 | int main() |
| 41 | 43 | { |
| 42 | - | |
| 43 | 44 | Example a(3); |
| 44 | 45 | |
| 45 | 46 | Example b = std::move(a); | ... | ... |
examples07/04-unique_ptr/makefile
| ... | ... | @@ -3,7 +3,9 @@ EXECUTABLES = 01-unique_ptr1 02-move 03-unique_ptr2 04-unique_ptr3_bad 05-unique |
| 3 | 3 | all: $(EXECUTABLES) |
| 4 | 4 | |
| 5 | 5 | %: %.cpp |
| 6 | - g++ -g -Wall -pedantic $< -o $@ | |
| 6 | + g++ -g -Wall -pedantic -fno-elide-constructors $< -o $@ | |
| 7 | +# g++ -g -Wall -pedantic $< -o $@ | |
| 8 | + | |
| 7 | 9 | |
| 8 | 10 | .PHONY: clean |
| 9 | 11 | ... | ... |