How to use smart pointers as Objective-C fields
Ruslan Zasukhin
sunshine at public.kherson.ua
Thu Aug 3 19:47:35 CDT 2006
On 8/3/06 6:56 PM, "Matthew Jew" <mjew at icnc.com> wrote:
>> We have had similar problems in VNET.
>>
>> Solution is:
>>
>> * continue to use simple pointers
>> FBL_ArraySet *myArray;
>>
>> * use AddRef() and Release
>>
>> PVArraySet()
>> {
>> myArray = pSet.get();
>> pSet->AddRef();
>> }
>>
>>
>> ~PVArraySet()
>> {
>> myArray->Release();
>> }
>>
>>
>>
>
> Okay, I can continue to use simple pointers and use AddRef and Release.
>
> I have a need to pass ArraySet references to and from my PVArraySet
> objects.
> If PVArraySet is using simple pointers and everywhere else is using Smart
> Pointers, how do I convert between the two? The compiler doesn't like it if I
> just cast from one to the other.
Look above my code. To "convert" smart_ptr into simple ptr you need use
.get()
ArraySet_Ptr p = new ArraySet;
ArraySet* sp = p.get();
To convert from simple to smart, nothing special, just assign
ArraySet_Ptr p2 = sp;
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list