[Insight-developers] Returning a smart pointer or a pointer?

Tom Vercauteren tom.vercauteren at gmail.com
Mon May 19 12:09:48 EDT 2008


Hi all,

Since I am not sure to fully understand ITK's policy regarding the use
of smart pointers versus pointers, I would appreciate any feedback on
the following question:
Why does itk::PDEDeformableRegistrationFunction::GetDeformationField
returns a smart pointer and not a pointer and can we change that?


The reason I am asking is because I realized that returning a smart
pointer was affecting the performance of my application. Changing the
return type to a usual pointer led to a measurable speedup.

Since most other functions return a usual pointer it seems like
itk::PDEDeformableRegistrationFunction::GetDeformationField should
also return a pointer. If we change the return type, some users may
run into backwards compatibility issues (e.g. a class inherits from
PDEDeformableRegistrationFunction but redefines GetDeformationField).
This seems unlikely though...


Thanks,
Tom


More information about the Insight-developers mailing list