[Insight-developers] itkGetConstMacro versus
itkGetConstReferenceMacro
Luis Ibanez
luis.ibanez at kitware.com
Fri Nov 5 22:13:47 EST 2004
I agree in that returning a const reference is always better
than returning the copy.
Actually it seems by having
itkGetConstReferenceMacro() and
itkGetConstObjectMacro()
we shouldn't need
itkGetConstMacro().
Luis
-----------------------------------------
Lorensen, William E (Research) wrote:
> Jim and I found a nasty bug yesterday that was related to the use of
> GetConstMacro. It's a long story, but the Get should have returned a
> reference rather than a copy.
>
> Last night, I replaced all GetConstMacro usage with GetConstReferenceMacro.
> Everything compiled and all tests passed on Borland and VS7.
>
> Can anyonoe think of a reason why this would be a bad move. Certainly,
> performace should be slightly better with the reference macro since a new
> version of the ivar need not be created.
>
> If there are no objections, I'll check this in later today. I'm building
> InsightApplications now.
>
> Bill
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>
>
More information about the Insight-developers
mailing list