Re: using vector<> and auto_ptr<> in an ActiveX control by Ken
Ken
Fri Aug 15 10:07:57 CDT 2003
"Micus" <None@nowhere.com> wrote in message
news:%23UePAMvYDHA.1816@TK2MSFTNGP09.phx.gbl...
> [VC6-SP5, WinME, ATL DLL]
> Hello all, I'm in the process of designing an ATL ActiveX control and would
> like to use auto_ptr<>, vector<>, and deque<> templates. Is anyone aware of
> any conflicts in doing this? I could hand-roll it, but why reinvent the
> wheel.
As you pointed out, ATL and STL coexist peacefully.
HOWEVER
auto_ptr<> should never be placed inside vector<> or deque<> or any STL
container. It's not compatible with the STL requirements for stored objects.
You may have already known that, but I just wanted to make sure. If you need
smart pointers inside STL containers, check out boost::shared_ptr
(www.boost.org).
Ken