Ticket #1420: test-code.cpp

File test-code.cpp, 529 bytes (added by rick68@…, 15 years ago)

test-code.cpp

Line 
1#include <iostream>
2#include <boost/cstdlib.hpp>
3#include <boost/optional/optional.hpp>
4
5struct 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
12int 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}