-
Notifications
You must be signed in to change notification settings - Fork 12
/
example.hpp
38 lines (30 loc) · 881 Bytes
/
example.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <iostream>
struct A {
A() { std::cout << "A()" << std::endl; }
A(const A &) { std::cout << "A(const A &)" << std::endl; }
A(A&&) { std::cout << "A(A&&)" << std::endl; }
~A() { std::cout << "~A()" << std::endl; }
A & operator = (const A &) {
std::cout << "operator = (const A &)" << std::endl;
return *this;
}
A & operator = (A &&) {
std::cout << "operator = (A &&)" << std::endl;
return *this;
}
};
struct B {
B() { std::cout << "B()" << std::endl; }
B(const B &) { std::cout << "B(const B &)" << std::endl; }
B(B&&) { std::cout << "B(B&&)" << std::endl; }
~B() { std::cout << "~B()" << std::endl; }
B & operator = (const B &) {
std::cout << "operator = (const B &)" << std::endl;
return *this;
}
B & operator = (B &&) {
std::cout << "operator = (B &&)" << std::endl;
return *this;
}
};