[vtk-developers] Implicit copy constructors in VTK

Sean McBride sean at rogue-research.com
Wed Jul 24 10:50:08 EDT 2013


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


More information about the vtk-developers mailing list