1 // Copyright David Abrahams 2001. 2 // Distributed under the Boost Software License, Version 1.0. (See 3 // accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 #ifndef COMPLICATED_DWA20011215_HPP 6 # define COMPLICATED_DWA20011215_HPP 7 # include <iostream> 8 9 # include "simple_type.hpp" 10 11 struct complicated 12 { 13 complicated(simple const&, int = 0); 14 ~complicated(); 15 16 int get_n() const; 17 18 char* s; 19 int n; 20 }; 21 complicated(simple const & s,int _n)22inline complicated::complicated(simple const&s, int _n) 23 : s(s.s), n(_n) 24 { 25 std::cout << "constructing complicated: " << this->s << ", " << _n << std::endl; 26 } 27 ~complicated()28inline complicated::~complicated() 29 { 30 std::cout << "destroying complicated: " << this->s << ", " << n << std::endl; 31 } 32 get_n() const33inline int complicated::get_n() const 34 { 35 return n; 36 } 37 38 #endif // COMPLICATED_DWA20011215_HPP 39