<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hans,<div><br></div><div>Exactly, if we are going to the trouble to create these new macros, might as well do something new and have the benefit of better error messages with c++11.</div><div><br></div><div>-Brad</div><div><br></div><div>p.s. Your logic below is backwards.</div><div><br></div><div><br><div><div>On Aug 15, 2013, at 4:01 PM, "Johnson, Hans J" <<a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<div style="word-wrap: break-word; font-size: 14px; font-family: Calibri, sans-serif; ">
<div>Brad,</div>
<div><br>
</div>
<div>Could these be macros?</div>
<div><br>
</div>
<div>#if C++11</div>
<div> DEFAULT_CONSTRUCTOR {}</div>
<div>#else</div>
<div> DEFAULT_CONSTRUCTOR = default;</div>
<div>#end</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223); ">
<span style="font-weight:bold">From: </span>Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, August 15, 2013 2:51 PM<br>
<span style="font-weight:bold">To: </span>Matt McCormick <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>><br>
<span style="font-weight:bold">Cc: </span>Slicer Development <<a href="mailto:slicer-devel@bwh.harvard.edu">slicer-devel@bwh.harvard.edu</a>>, ITK <<a href="mailto:insight-developers@itk.org">insight-developers@itk.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Insight-developers] [slicer-devel] Improved readability of VTK derived class - What would you think of VTK_DISABLE_COPY macro ?<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap:break-word">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 <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div dir="ltr">Hi Jc,
<div><br>
</div>
<div>I like the idea -- it is more explicit, and it saves time. 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"><<a href="mailto:jchris.fillionr@kitware.com" target="_blank">jchris.fillionr@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex" type="cite">
<div dir="ltr">Hi Folks,
<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. </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 ... </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 .... </div>
<div><br>
</div>
<div>// -----------------</div>
<div>
<div>class MyClass : public vtkObject</div>
<div>{</div>
<div><br>
</div>
<div> private:</div>
<div> VTK_DISABLE_COPY(MyClass)</div>
<div>};</div>
<div>// -----------------<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>instead of </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> private:</div>
<div> MyClass(const MyClass &);</div>
<div> MyClass &operator=(const MyClass &);</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. </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] <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] <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] <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>
<a href="http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel">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">http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ</a></blockquote>
</div>
<br>
</div>
</div>
</div>
</span><br>
<br>
<hr>
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.
<hr>
</div>
</blockquote></div><br></div></body></html>