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

_______________________________________________
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