<div dir="ltr"><div>Hi all,<br><br>See the patch here: <a href="http://review.source.kitware.com/#/c/14418/">http://review.source.kitware.com/#/c/14418/</a><br><br></div><div>Best,<br></div>Brian<br><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Feb 12, 2014 at 9:48 AM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think this constructor is missing the "explicit" keyword. This may help in some situations.<br>
<br>
Brad<br>
<div><div class="h5"><br>
<br>
On Feb 12, 2014, at 9:41 AM, Tim Allman <<a href="mailto:dr.tim.allman@gmail.com">dr.tim.allman@gmail.com</a>> wrote:<br>
<br>
> This brings up an issue with respect to design in C++.<br>
><br>
> I have made far too many mistakes like this over the years, usually in my own code but with third party libraries as well. This strikes me as a constructor that was written as a "convenience" and the compiler happily tried to find a way of turning the returned scalar into a vector and made no complaints when it did.<br>

><br>
> I would probably not included this constructor at all because the following would do the same thing and the code would be clearer and less brittle. If it turned out to be useful I would have made it explicit.<br>
><br>
> ...<br>
> itk::Vector<double, 3> vec;<br>
> vec.Fill(28.0);<br>
> ...<br>
><br>
> I think C++ tries to be too friendly and it is too easy to write perfectly legal code which doesn't do what you expect.<br>
><br>
> Just a few thoughts,<br>
> Tim<br>
><br>
> On 14-02-11 07:54 PM, Bradley Lowekamp wrote:<br>
>> David,<br>
>><br>
>> Thanks for updating the Wiki Examples.<br>
>><br>
>> Brad<br>
>><br>
>> On Feb 11, 2014, at 3:45 PM, David Doria <<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>> wrote:<br>
>><br>
>>> On Tue, Feb 11, 2014 at 3:04 PM, Bradley Lowekamp<br>
>>> <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>> wrote:<br>
>>>> <a href="http://www.itk.org/Doxygen/html/classitk_1_1Vector.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1Vector.html</a><br>
>>>><br>
>>>> The return type for the operator* for a dot product is Vector::ValueType, a<br>
>>>> scalar, not a vector.<br>
>>>> <a href="http://www.itk.org/Doxygen/html/classitk_1_1Vector.html#a51bad5a3835ffc0fbbc02d5437f7e691" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1Vector.html#a51bad5a3835ffc0fbbc02d5437f7e691</a><br>

>>>><br>
>>>> By assigning to to a new Vector are implicitly calling this constructor:<br>
>>>> <a href="http://www.itk.org/Doxygen/html/classitk_1_1Vector.html#a106ee9550311054cceb66015e98c6457" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1Vector.html#a106ee9550311054cceb66015e98c6457</a><br>

>>>><br>
>>>> The example is wrong. Watch your types.<br>
>>>><br>
>>>> Brad<br>
>>> Brad is right - the 'dotproduct' variable in the example should be a<br>
>>> VectorType::ComponentType, not just VectorType. I updated the page<br>
>>> with the fix.<br>
>>><br>
>>> David<br>
>>> _____________________________________<br>
>>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>><br>
>>> Visit other Kitware open-source projects at<br>
>>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>><br>
>>> Kitware offers ITK Training Courses, for more information visit:<br>
>>> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>>><br>
>>> Please keep messages on-topic and check the ITK FAQ at:<br>
>>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>><br>
>>> Follow this link to subscribe/unsubscribe:<br>
>>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>> _____________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Kitware offers ITK Training Courses, for more information visit:<br>
>> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>><br>
>> Please keep messages on-topic and check the ITK FAQ at:<br>
>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
> --<br>
> Tim Allman, Ph.D.<br>
> 35 Margaret Street,<br>
> Guelph Ontario N1E 5R6<br>
> Canada<br>
><br>
</div></div>> <dr_tim_allman.vcf>_____________________________________<br>
<div class="im HOEnZb">> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Brian Helba<br>Medical Imaging<br>Kitware, Inc.<br>
</div>