[vtk-developers] RFC: vtkScopedPointer - a new hope?

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Jan 25 14:57:31 EST 2011


I have put the entire topic branch up on the topic stage (vtkNew). I
will merge it in the morning unless I hear different (it is getting
late and I need to leave early today). It was never intended to
replace vtkSmartPointer, more complement it with a set of related use
cases where it would be more appropriate. Hopefully this is clearer in
the documentation now too.

Marcus

On Tue, Jan 25, 2011 at 1:26 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> 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