[vtk-developers] Implicit copy constructors in VTK

David E DeMarle dave.demarle at kitware.com
Wed Jul 24 11:15:12 EDT 2013


Changed the document, Robert please revise as you see fit.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Wed, Jul 24, 2013 at 11:06 AM, Robert Maynard <robert.maynard at kitware.com
> wrote:

> The VTK coding standards should be amended to state that those rules
> are only valid for classes that derive from vtkObject.
>
> Classes like vtkBond, vtkTuple, vtkBoundingBox all which don't inherit
> from vtkObject should follow the rule of three and implement the copy
> and assignment constructor if they implement a destructor.
>
> On Wed, Jul 24, 2013 at 10:50 AM, Sean McBride <sean at rogue-research.com>
> wrote:
> > Hi all,
> >
> > So I'm looking at the clang warnings on Rogue7, but need C++ help before
> I can proceed further.  We have two similar warnings, repeated for several
> classes:
> >
> > VTK/Common/DataModel/vtkBond.h:30:3: warning: definition of implicit
> copy constructor for 'vtkBond' is deprecated because it has a user-declared
> destructor [-Wdeprecated]
> >   ~vtkBond();
> >   ^
> >
> > VTK/Common/Math/vtkQuaternion.h:201:8: warning: definition of implicit
> copy constructor for 'vtkQuaternion<float>' is deprecated because it has a
> user-declared copy assignment operator [-Wdeprecated]
> >   void operator=(const vtkQuaternion<T>& q);
> >        ^
> >
> > From what I can tell, in C++11, the implicit generation of copy
> constructors is now deprecated if 1) you provide a user-declared destructor
> or 2) you provide a user-declared copy assignment operator.
> > <http://stackoverflow.com/a/11255258>
> >
> > So it would seem a solution is to provide an explicit copy constructor,
> but VTK's coding standards gives me pause: "Classes should have protected
> constructors and destructors, and privately declared but unimplemented copy
> constructor and assignment operator. Rationale: VTK’s reference counting
> implementation depends on carefully controlling each object’s reference
> count".
> >
> > So now I'm not sure how to proceed...
> >
> > Thanks,
> >
> > --
> > ____________________________________________________________
> > Sean McBride, B. Eng                 sean at rogue-research.com
> > Rogue Research                        www.rogue-research.com
> > Mac Software Developer              Montréal, Québec, Canada
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtk-developers
> >
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130724/208ebfa5/attachment.html>


More information about the vtk-developers mailing list