[ITK Community] [Insight-users] no itkSetOutputMacro?

Luis Ibanez luis.ibanez at kitware.com
Sat Jan 18 11:28:38 EST 2014


On Mon, Jan 13, 2014 at 4:25 AM, Joël Schaerer <joel.schaerer at gmail.com>wrote:

>
>> Given that in C++, the return type is not part of the signature of a
>> function,
>> we couldn't have two methods with the same name and input parameters
>> but with different return types.
>>
>> Namely:
>>
>>               DataObject  * myFilter->GetTransform();
>>               TransformType * myFilter->GetTransform();
>>
>>
> Couldn't the output macro get a type parameter, similarly to the input
> macro?
>
>         itkGetOutputMacro(name,type)
>
> That would generate the second method directly, with no conflict if I
> understand correctly. Unless of course you want the output type to be
> dynamic, which doesn't seem like a very frequent case.
>
> What am I missing?
>
>

Joel,


The macro that you suggest could indeed generate the two functions above.

But C++ will not allow us to have two functions whose only difference is
the return type.

The following example may help to illustrate the problem:


cat returntype.cxx

class Foo {

int   bar();
float bar();

};



g++ -c returntype.cxx

returntype.cxx:4:7: error: ‘float Foo::bar()’ cannot be overloaded
returntype.cxx:3:7: error: with ‘int Foo::bar()’




    Regards,

         Luis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140118/988cd24c/attachment-0002.html>
-------------- next part --------------
_____________________________________
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://www.kitware.com/products/protraining.php

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 Community mailing list