<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 13, 2014 at 4:25 AM, Joël Schaerer <span dir="ltr"><<a href="mailto:joel.schaerer@gmail.com" target="_blank">joel.schaerer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Given that in C++, the return type is not part of the signature of a function,<br>
we couldn't have two methods with the same name and input parameters<br>
but with different return types.<br>
<br>
Namely:<br>
<br>
              DataObject  * myFilter->GetTransform();<br>
              TransformType * myFilter->GetTransform();<br>
<br>
</blockquote>
<br></div>
Couldn't the output macro get a type parameter, similarly to the input macro?<br>
<br>
        itkGetOutputMacro(name,type)<br>
<br>
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.<br>
<br>
What am I missing?<br>
<br></blockquote><div><br></div><div><br></div><div>Joel,</div><div><br></div><div><br></div><div>The macro that you suggest could indeed generate the two functions above.</div><div><br></div><div>But C++ will not allow us to have two functions whose only difference is the return type.</div>
<div><br></div><div>The following example may help to illustrate the problem:</div><div><br></div><div><br></div><div><div>cat returntype.cxx </div><div><br></div><div>class Foo {</div><div><br></div><div>int   bar();</div>
<div>float bar();</div><div><br></div><div>};</div><div><br></div><div><br></div><div><br></div><div> g++ -c returntype.cxx </div><div><br></div><div>returntype.cxx:4:7: error: ‘float Foo::bar()’ cannot be overloaded</div>
<div>returntype.cxx:3:7: error: with ‘int Foo::bar()’</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div>    Regards,</div><div><br></div><div>         Luis</div><div><br></div></div></div></div>