Hans, 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.
-Brad p.s. Your logic below is backwards. On Aug 15, 2013, at 4:01 PM, "Johnson, Hans J" <[email protected]> wrote: > Brad, > > Could these be macros? > > #if C++11 > DEFAULT_CONSTRUCTOR {} > #else > DEFAULT_CONSTRUCTOR = default; > #end > > From: Bradley Lowekamp <[email protected]> > Date: Thursday, August 15, 2013 2:51 PM > To: Matt McCormick <[email protected]> > Cc: Slicer Development <[email protected]>, ITK > <[email protected]> > Subject: Re: [Insight-developers] [slicer-devel] Improved readability of VTK > derived class - What would you think of VTK_DISABLE_COPY macro ? > > 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. > > I messed a bit with in in SimpleITK, though I don't think I turned it on: > https://github.com/SimpleITK/SimpleITK/blob/master/Code/Common/include/sitkNonCopyable.h#L60 > > I think it would make the change to the newer C++ code easier. > > Brad > > On Aug 15, 2013, at 3:43 PM, Matt McCormick <[email protected]> > wrote: > >> Hi Jc, >> >> 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? >> >> Thanks, >> Matt >> >> >> On Thu, Aug 15, 2013 at 6:11 PM, Jean-Christophe Fillion-Robin >> <[email protected]> wrote: >>> Hi Folks, >>> >>> 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. >>> >>> >>> 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 ... >>> >>> >>> This macro would be similar to what is done in Qt with Q_DISABLE_COPY. For >>> details [3] >>> >>> >>> For example, to declare the class MyClass, you would do .... >>> >>> // ----------------- >>> class MyClass : public vtkObject >>> { >>> >>> private: >>> VTK_DISABLE_COPY(MyClass) >>> }; >>> // ----------------- >>> >>> >>> >>> instead of >>> >>> >>> >>> // ----------------- >>> class MyClass : public vtkObject >>> { >>> >>> private: >>> MyClass(const MyClass &); >>> MyClass &operator=(const MyClass &); >>> }; >>> // ----------------- >>> >>> >>> >>> The more people reply to this email, the more chance we will have to see >>> this macro added to VTK6. >>> >>> >>> Let us know what you think. >>> >>> >>> Thanks >>> Jc >>> >>> >>> [1] >>> http://vtk.1045678.n5.nabble.com/Implicit-copy-constructors-in-VTK-tp5722193p5722205.html >>> >>> [2] >>> http://vtk.1045678.n5.nabble.com/Implicit-copy-constructors-in-VTK-tp5722193p5722217.html >>> >>> [3] http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#Q_DISABLE_COPY >>> >>> -- >>> +1 919 869 8849 >>> >>> _______________________________________________ >>> slicer-devel mailing list >>> [email protected] >>> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel >>> To unsubscribe: send email to [email protected] >>> with unsubscribe as the subject >>> http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ >> >> _______________________________________________ >> slicer-devel mailing list >> [email protected] >> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel >> To unsubscribe: send email to [email protected] >> with unsubscribe as the subject >> http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ > > > > 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
