boost:shared ptr in classes
-
Hello, i would like to have a class with a shared pointer to some data. Data can be constructed with a structure astructure. So far the compiler is crashing, as soon as I try to access m_data. How do I have to implement this with using shared_ptr, or am I misusing the shared_ptr anyways ?
Class1 { boost::shared_ptr m_data; public: Class1(); Class1(const astructure& source) Class1(const class1& source) } //I would like to generate Data with a data from the structure astructure Class1::Class1 (const astructure& source) { m_data.reset (new Data(astructure.m1, astructure.m2)); } //I would like to have a copy constructor Class1::Class1 (const Class1& source) { m_data = source.m_data; }
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx -- modified at 3:51 Monday 19th December, 2005