Boost logo

Boost Users :

From: John Sun (jsunnewsgroup_at_[hidden])
Date: 2005-09-29 18:04:10


New to this topic,and need some help here.

I have a class which use the scoped_ptr as a member variable.

Class CTest
{
public:
  CTest();
  Initialize();
  ~CTest();
private:
   scoped_ptr<CTest2> m_spTest2;
}

For some reason, that I cannot initialize m_spTest2 in the member
initialization list of the constructor, so I have to initialize in some
other functions like in Initialize.

CTest::Initialize()
{
  int aa, bb;
  m_spTest2=new CTest2(aa, bb);
}

The compiler will complain about that, so what's the right way to do it.

Thanks,
Jianwei


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net