[vtkusers] Creating an array of objects of a VTK-class

Dmitri Danewitz d.danewitz at yahoo.de
Sun Aug 9 16:23:28 EDT 2009


Thanks a lot!

--- Bill Lorensen <bill.lorensen at gmail.com> schrieb am Sa, 8.8.2009:

Von: Bill Lorensen <bill.lorensen at gmail.com>
Betreff: Re: [vtkusers] Creating an array of objects of a VTK-class
An: "Dmitri Danewitz" <d.danewitz at yahoo.de>
CC: vtkusers at vtk.org
Datum: Samstag, 8. August 2009, 17:38

You could use and std::vector<vtkRectilinearGridReader *> Reader;
for(int nr = 0; nr < number; nr++)
  {
  Reader.push_back(vtkRectilinearGridReader::New());
  }

or you could use the older C-style with malloc


On Sat, Aug 8, 2009 at 12:57 PM, Dmitri Danewitz<d.danewitz at yahoo.de> wrote:
> Hello,
>
> I'm trying to create multiple objects of the vtkRectilinearReader class. It
> works fine, if I do it like this:
>
> const int number = 4;
>   vtkRectilinearGridReader *Reader[number];
>   for(int nr = 0; nr < number; nr++)
>   {
>    Reader[nr] = vtkRectilinearGridReader::New();
>   }
>
>
> But when "number" is not a constant, this doesn't work. Is there a away to
> do this without having "number" to be a constant?
>
> Thanks
> Dmitri
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090809/72f6f3cd/attachment.htm>


More information about the vtkusers mailing list