[Insight-developers] Is it ok to return values in function params?
M Stauffer (V)
mstauff at verizon.net
Thu Feb 10 17:21:31 EST 2011
OK, thanks Luis. I've seen that before in Transform* now that you
mention it -- should've remembered.
But now I'm having some multithreading-related problem anyway. I may
have to use my functor with per-thread copies anyway, in which case
using a member-variable for return-by-reference would work.
Cheers,
Michael
>-----Original Message-----
>From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
>Sent: Thursday, February 10, 2011 5:10 PM
>To: M Stauffer (V)
>Cc: ITK
>Subject: Re: [Insight-developers] Is it ok to return values in
>function params?
>
>Michael
>
>We do that in several instances,
>
>For example
>
>Image::TransformPhysicalPointToIndex( inputPoint, outputIndex );
>Image::TransformIndexToPhysicalPoint( inputIndex, outputPoint );
>
>Usually returned by reference.
>
> Luis
>
>
>-------------------------------
>On Thu, Feb 10, 2011 at 2:25 PM, M Stauffer (V)
><mstauff at verizon.net> wrote:
>> Hi,
>>
>> Is it accepted in ITK style to return values in function
>parameters? I'd
>> like to return a functor result by value, but using a class member to
>> hold the result for return-by-value means it won't be thread-safe. I
>> could make multiple copies of the functor when used in a threaded
>> context, but that means the class is harder to use properly.
>If I use a
>> function parameter to return the result, it would be thread-safe.
>>
>> Cheers,
>> Michael
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.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-developers
>>
More information about the Insight-developers
mailing list