[vtk-developers] RFC: vtkScopedPointer - a new hope?
Bill Lorensen
bill.lorensen at gmail.com
Tue Jan 25 13:26:59 EST 2011
Sounds good to me. People can still use SmartPointer if they want, or a macro.
The new vtkNew seems cleaner and safer.
Bill
On Tue, Jan 25, 2011 at 1:24 PM, Brad King <brad.king at kitware.com> wrote:
> On 01/25/2011 01:08 PM, Bill Lorensen wrote:
>> I think I understand your argument.
>>
>> However, I was looking for a simple drop-in similar to what Brad
>> experimented with last March.
>>
>> I can't recall the details of his implementation nor why we abandoned it.
>
> It was abandoned due to a problem achieving the syntax
>
> vtkSmartPointer<vtkBase> b = vtkNew<vtkDerived>();
>
> Later I actually did find a way to achieve it but it comes at the cost
> of allowing some dangerous copies of vtkNew<> instances without any
> compile-time diagnosis. Other than providing
>
> T* GetPointer() const
>
> instead of
>
> operator T*() const
>
> Marcus's vtkNew is a strict subset of my latest version that does not
> allow the above syntax but also avoids the dangerous cases. His vtkNew
> can be converted to mine with the addition of a few lines so we can
> change our mind later.
>
> -Brad
>
More information about the vtk-developers
mailing list