I've tried switching some C++Builder 2010 code using new
to use boost::make_shared<>
, as below.
Old:
boost::shared_ptr<TStringList> l(new TStringList());
New:
boost::shared_ptr<TStringList> l(boost::make_shared<TStringList>());
l->Add("foo"); //dies here
The old code works, but the new code dies when I try and use the pointer (AV, or just hangs).
I've used make_shared
and shared_ptr
successfully before, but never with TObject
descendants. Is this a known problem - perhaps something to do withe the way make_shared
uses placement new()
??