[vtkusers] Array of vtkclasses
David Gobbi
dgobbi at atamai.com
Tue Sep 26 11:22:17 EDT 2006
Hi Arnolfo,
If you are a fan of the STL, a nice way to do this is with smart pointers:
#include "vtkstd/vector"
#include "vtkSmartPointer.h"
// create the vector
vtkstd::vector<vtkSmartPointer<vtkActor> > actors;
// initialize the vector
for (int i = 0; i < n; i++)
{
vtkActor *actor = vtkActor::New();
actors.push_back(actor);
// delete, since now the vector owns the reference
actor->Delete();
}
- David
Arnolfo Marciales wrote:
> Hi i need to make a undefined array of vtkActors.
> I can define with
>
> vtkActor *vtkActors[x];
> but with
>
> vtkActor *vtkActors[];
> i receive an compilation error
>
> Can i use stl vector library with vtkActor?
> If so, How i call ::New() command from the stl::vector function?
>
> thanks,
> Fito
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list