[vtkusers] A template to avoid calling vtkObjectBase->Delete()

REGAT-BARREL Aurélien arbvtk at yahoo.fr
Wed Apr 28 12:14:15 EDT 2004


    de Boer Ingo <I.deBoer at polytec.de> wrote:
    Hi,
Hello,

    I did a similar approach based on M$ CAutoPtr class
    shipped with the Visual Studio.
    I guess, it is better to make it a bit more safe...
    Maybe this could be a suggestion for making 
    vtkSmartPointer a bit safer ?
    
    The usage is like:
    
    CVtkPtr pvtkAxes;
    pvtkAxes.Create();
    pvtkAxes->SetOrigin(0, 0, 0);
    
    and you can ask for result of create to do something
    when the creation fails...

It is interesting.
I also thought about a Create fonction (directly in the constructor).
But i am wondering if it is not better to minimalize the impact on "traditional" VTK code.
With my first example, if a guy has not my template header, he can change the typedef
    typedef vtkClassPtr< vtkConeSource > vtkConeSourcePtr;
to
    typedef vtkConeSource * vtkConeSourcePtr;
And it works (but with potential memory leaks...)




Aurélien REGAT-BARREL
		
---------------------------------
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040428/1bc923df/attachment.htm>


More information about the vtkusers mailing list