Opened 13 years ago

Closed 13 years ago

#315 closed request (fixed)

Create a SmartPtr<T> class

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.4
Component: utility Version:
Keywords: Cc:

Description

daughter of ticket:287

Class holds a pointer T*

Also it holds a reference_counter in a u_int*. If u_int* is NULL class is not owner of the T*. If u_int* is not NULL the pointer is used to count how many owner T* has. Increment and decrement in assignment and copying - see DataLookup2D for this behavior.

Class SmartPtr? can be created either from a pointer, in which case reference counter is set to one. SmartPtr? can also be created from another Smartptr i.e. a copy constructor. For time being we do not allow copying from one type to another.

This class belongs in utility.

Change History (3)

comment:1 Changed 13 years ago by Peter

In case of constructor from a dummie pointer I think we should allow user to set owner=false, i.e. ref_count u_int* is NULL.

comment:2 Changed 13 years ago by Peter

Owner: changed from Jari Häkkinen to Peter
Status: newassigned

comment:3 Changed 13 years ago by Peter

Resolution: fixed
Status: assignedclosed

in [1044]

Note: See TracTickets for help on using tickets.