[vtk-developers] Plan to make CMake 3.3 and C++11 required

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Jan 17 12:04:19 EST 2017


On Tue, Jan 17, 2017 at 11:52 AM, David Gobbi <david.gobbi at gmail.com> wrote:
> There's definitely a place for std::unique_ptr in VTK, however.  There's
> lots of code that does local allocation with new/delete that could be
> cleaned up.

Although vtkNew fills that role quite well too, and can be used with
the other VTK smart pointers quite easily. For those that wanted to
use unique_ptr it would be good to make that easy for them, but I
wonder if tweaks to vtkNew would be preferable unless we make
vtkObject derived classes behave more like normal C++ classes, i.e.
removing implicit reference counting, allowing use of new/delete
operators, managing memory using STL smart pointers.
>
> I believe that the main thing holding us back from more widespread use of
> smart pointers is our rule for using forward declarations in VTK headers,
> rather than including other headers.   And it's a rule that I don't want to
> see changed.
>
I thought it was also the design of the vtkObject base class, and the
implicit reference counting. Unless we make very significant changes
to the vtkObject hierarchy/design it would seem like a terrible idea
to pay for implicit reference counting and for C++11 smart pointers.
The use of the object factory mechanism forcing the use of the static
New() also adds some overhead.


More information about the vtk-developers mailing list