[Variant]Pointers to using pointers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Variant]Pointers to using pointers

Conway Allen

The following, I suppose, produces a memory leak… is there any way to avoid this? Don’t use variant with pointers… ?

 

variant<T1*,T2*> vt; 
vt = new T1; 
vt = new T2; 

 

Thanks, Allen.


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Variant]Pointers to using pointers

Alan M. Carroll
That is correct, don't use pointers with Boost.Variant.

Boost.Variant works well with smart pointers, however, such as Boost.shared_ptr and Boost. intrusive_ptr.

At 11:46 AM 3/17/2006, Conway Allen wrote:
content-class: urn:content-classes:message
Content-Type: multipart/alternative;
         boundary="----_=_NextPart_001_01C649EA.C6E9587E"

The following, I suppose, produces a memory leak… is there any way to avoid this? Don’t use variant with pointers… ?
 
variant<T1*,T2*> vt;
vt = new T1;
vt = new T2;
 
Thanks, Allen.
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users