[vtk-developers] Smart pointer declaration macro?

David Gobbi david.gobbi at gmail.com
Thu Jan 28 10:33:01 EST 2010


I vote for:

4. vtkLocalPointer<vtkClass> instance;

  - David

On Thu, Jan 28, 2010 at 8:31 AM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> On Thursday 28 January 2010 10:16:24 Jeff Baumes wrote:
>> On Thu, Jan 28, 2010 at 10:00 AM, Will Schroeder
>>
>> <will.schroeder at kitware.com> wrote:
>> > Jeff can you summarize the proposed solutions (assuming we think we've
>> > covered the bases) and let's take a vote on this. I want to keep my inbox
>> > clear :-(
>>
>> 1. Keep things the way they are:
>> vtkSmartPointer<vtkClass> c = vtkSmartPointer<vtkClass>::New();
>>
>> 2. Add new constructor to vtkSmartPointer that takes a bool and if
>> true creates an instance of the object. Code would look like:
>> vtkSmartPointer<vtkClass> c(true);
>>
>> 3. Create typedefs for vtkSmartPointer<vtkClass>:
>> vtkClassSP c = vtkClassSP::New();
>>
>> 4. Make a new vtkLocalPointer type that is the same as vtkSmartPointer
>> but always creates an instance of the object.
>> vtkLocalPointer<vtkClass> c;
>>
>> Unfortunately our inboxes won't be clear until everyone responds with
>> a vote (I'd maybe give it till 12pm eastern time). We can take it to
>> the ARB if there is no clear consensus.
>>
> My favorite is 4, then 2. I was thinking of reasonably concise API, I think 1
> has needless repetition and does not make the code any clearer.
>
> Marcus
>



More information about the vtk-developers mailing list