[Insight-users] array of smart pointers
Xiaofeng Z
xf10036 at hotmail.com
Thu Oct 15 23:41:17 EDT 2009
Did you initialized the allocated memory? Besides, unless you know the
inner details of the smarter pointer, you don't really know how to
initialize the memory.
--------------------------------------------------
From: "Kevin H. Hobbs" <hobbsk at ohiou.edu>
Sent: Thursday, October 15, 2009 1:54 PM
To: "Insight Users List" <insight-users at itk.org>
Subject: [Insight-users] array of smart pointers
> My (unfinished and attached) program is segfaulting at line 192 where I
> create a new image smart pointer and assign it to an element of an array
> of smart pointers.
>
> recv_images[ split ] = FloatImageType::New();
>
> I got the array of smart pointers from malloc with :
>
> FloatImageType::Pointer * recv_images =
> (FloatImageType::Pointer *) malloc(
> mpi_size * sizeof( FloatImageType::Pointer ));
>
> I know this isn't very C++ish but shouldn't it work?
>
> _____________________________________
> 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 ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list