Kent,

I am giving some comment to you patch now.

I agree with what you said.

If the thing you are copying is a template, typedef then std::copy should be 
used.

But there are many cases you change which use static_cast<char*>, in these 
cases you loose the type safety of std::copy, and I don't see the point of the 
change.

Brad

On Apr 10, 2013, at 10:09 AM, "Williams, Norman K" 
<[email protected]> wrote:

> The big issue I ran into with memcpy was where it happened in a case where
> it was copying an array of objects whose type was a template parameter,
> that could potentially be a C++ class type.
> 
> In that case it is potentially disastrous, and probably hard to debug.
> std::copy & std::fill have requirements with respect to the type of
> objects copied: they need to have an operator= (defined or default) or a
> constructor taking the fill type respectively.
> 
> In our templated code, throwing a compiler error by enforcing those
> constraints is a good thing; where memcpy could silently fail,
> std::copy/std::fill will complain.
> 
> --
> Kent Williams [email protected]
> 
> 
> 
> 
> 
> 
> On 4/10/13 9:04 AM, "Bradley Lowekamp" <[email protected]> wrote:
> 
>> Bill,
>> 
>> I think that copy is required for generic programming like much of ITK.
>> 
>> But when you have a known type, I don't see any reason to look down on
>> memcpy.
>> 
>> Brad
>> 
>> On Apr 9, 2013, at 5:02 PM, Bill Lorensen <[email protected]> wrote:
>> 
>>> Kent says:
>>> "There are (before this patch) 88 calls to memcpy
>>> in the ITK source code."
>>> 
>>> In VTK, there are 2076 uses of memcpy in 452 classes.. Perhaps the
>>> older sibling can learn from the younger.
>>> 
>>> There are 34 uses of std::copy in vtk.
>>> 
>>> Bill
>>> 
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>> _______________________________________________
>>> 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.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-developers
>> 
>> _______________________________________________
>> 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.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-developers
> 
> 
> 
> ________________________________
> Notice: This UI Health Care e-mail (including attachments) is covered by the 
> Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential 
> and may be legally privileged.  If you are not the intended recipient, you 
> are hereby notified that any retention, dissemination, distribution, or 
> copying of this communication is strictly prohibited.  Please reply to the 
> sender that you have received the message in error, then delete it.  Thank 
> you.
> ________________________________

_______________________________________________
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.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-developers

Reply via email to