<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">New with C++11 you can explicitly delete these methods. It may give better compiler error messages. It may be worth the try compile to give a useful error message to users.<div><br></div><div>I messed a bit with in in SimpleITK, though I don't think I turned it on:</div><div><a href="https://github.com/SimpleITK/SimpleITK/blob/master/Code/Common/include/sitkNonCopyable.h#L60">https://github.com/SimpleITK/SimpleITK/blob/master/Code/Common/include/sitkNonCopyable.h#L60</a></div><div><br></div><div>I think it would make the change to the newer C++ code easier.</div><div><br></div><div>Brad</div><div><br><div><div>On Aug 15, 2013, at 3:43 PM, Matt McCormick &lt;<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><div dir="ltr">Hi Jc,<div><br></div><div>I like the idea -- it is more explicit, and it saves time. &nbsp;What do members of the ITK community think of an itkDisableCopy(MyClass) macro?</div><div><br></div><div>Thanks,</div><div>
Matt</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 15, 2013 at 6:11 PM, Jean-Christophe Fillion-Robin <span dir="ltr">&lt;<a href="mailto:jchris.fillionr@kitware.com" target="_blank">jchris.fillionr@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Folks,&nbsp;<div><br></div><div>On the VTK developer list, I recently discussed the introduction of a new VTK macro named "VTK_DISABLE_COPY" [1][2] that would allow to easily disable assignment and copy constructor in VTK class deriving from vtkObject.&nbsp;</div>


<div><br></div><div><br></div><div>Note that disabling these constructors for class deriving from vtkObject IS mandatory, it has to be done. You probably already copied this two constructor lines over and over ...&nbsp;</div>


<div><br></div><div><br></div><div>This macro would be similar to what is done in Qt with Q_DISABLE_COPY. For details [3]</div><div><br></div><div><br></div><div>For example, to declare the class MyClass, you would do ....&nbsp;</div>


<div><br></div><div>// -----------------</div><div><div>class MyClass : public vtkObject</div><div>{</div><div><br></div><div>&nbsp; private:</div><div>&nbsp; &nbsp; VTK_DISABLE_COPY(MyClass)</div><div>};</div><div>// -----------------<br>


</div><div><br></div><div><br></div><div><br></div><div>instead of&nbsp;</div><div><br></div><div><br></div><div><br></div><div>// -----------------<br></div><div>class MyClass : public vtkObject</div><div>{</div>

<div><br></div><div>&nbsp; private:</div><div>&nbsp; &nbsp; &nbsp;MyClass(const MyClass &amp;);</div><div>&nbsp; &nbsp; &nbsp;MyClass &amp;operator=(const MyClass &amp;);</div><div>};</div></div><div>// -----------------<br></div><div><br></div><div><br></div>


<div><br></div><div>The more people reply to this email, the more chance we will have to see this macro added to VTK6.&nbsp;</div><div><br></div><div><br></div><div>Let us know what you think.</div><div>

<br></div><div><br></div><div>Thanks</div><div>Jc</div><div><br></div><div><br></div><div>[1]&nbsp;<a href="http://vtk.1045678.n5.nabble.com/Implicit-copy-constructors-in-VTK-tp5722193p5722205.html" target="_blank">http://vtk.1045678.n5.nabble.com/Implicit-copy-constructors-in-VTK-tp5722193p5722205.html</a></div>


<div><br></div><div>[2]&nbsp;<a href="http://vtk.1045678.n5.nabble.com/Implicit-copy-constructors-in-VTK-tp5722193p5722217.html" target="_blank">http://vtk.1045678.n5.nabble.com/Implicit-copy-constructors-in-VTK-tp5722193p5722217.html</a></div>


<div><br></div><div>[3]&nbsp;<a href="http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#Q_DISABLE_COPY" target="_blank">http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#Q_DISABLE_COPY</a><span class="HOEnZb"><font color="#888888"><br clear="all">
<div><br></div>-- <br><a href="tel:%2B1%20919%20869%208849" value="+19198698849" target="_blank">+1 919 869 8849</a><br>


</font></span></div></div>
<br>_______________________________________________<br>
slicer-devel mailing list<br>
<a href="mailto:slicer-devel@bwh.harvard.edu">slicer-devel@bwh.harvard.edu</a><br>
<a href="http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel" target="_blank">http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel</a><br>
To unsubscribe: send email to <a href="mailto:slicer-devel-request@massmail.spl.harvard.edu">slicer-devel-request@massmail.spl.harvard.edu</a> with unsubscribe as the subject<br>
<a href="http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ" target="_blank">http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ</a><br></blockquote></div><br></div>
_______________________________________________<br>slicer-devel mailing list<br><a href="mailto:slicer-devel@bwh.harvard.edu">slicer-devel@bwh.harvard.edu</a><br>http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel<br>To unsubscribe: send email to slicer-devel-request@massmail.spl.harvard.edu with unsubscribe as the subject<br>http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ</blockquote></div><br></div></body></html>