1 | #include <iostream>
|
---|
2 | #include <boost/cstdlib.hpp>
|
---|
3 | #include <boost/optional/optional.hpp>
|
---|
4 |
|
---|
5 | struct A
|
---|
6 | {
|
---|
7 | A(void) { std::cout << "A constructor (" << this << ')' << std::endl; }
|
---|
8 | A(const A&) { std::cout << "A copy constructor (" << this << ')' << std::endl; }
|
---|
9 | ~A(void) { std::cout << "A destructor (" << this << ')' << std::endl; }
|
---|
10 | };
|
---|
11 |
|
---|
12 | int main(void)
|
---|
13 | {
|
---|
14 | A a1;
|
---|
15 | boost::optional<A> opt1(a1);
|
---|
16 | boost::optional<A> opt2;
|
---|
17 |
|
---|
18 | std::cout << std::endl;
|
---|
19 | opt2 = opt1;
|
---|
20 | std::cout << std::endl;
|
---|
21 |
|
---|
22 | return boost::exit_success;
|
---|
23 | }
|
---|