How to use smart pointers as Objective-C fields

Matthew Jew mjew at icnc.com
Wed Aug 2 17:38:58 CDT 2006


Hello,

I made an Objective C class that acts as a sort of wrapper from the  
old FBL_ArraySet.
It was defined like this:

@interface PVArraySet : NSObject <NSCopying, NSCoding>
{
	FBL_ArraySet *myArray;
}


Now, with the new Smart Pointers, I have modified it to be like this:

@interface PVArraySet2 : NSObject <NSCopying, NSCoding>
{
	ArraySet_Ptr myArray;
}

However, when I do that, I get the following compilation warnings:

/Volumes/Alpha2/Dev-NuPV/PVReplicator2/../Common-Classes/Classes/ 
PVArraySet2.h:18: warning: type `ArraySet_Ptr' has a user-defined  
constructor
/Volumes/Alpha2/Dev-NuPV/PVReplicator2/../Common-Classes/Classes/ 
PVArraySet2.h:18: warning: type `ArraySet_Ptr' has a user-defined  
destructor
/Volumes/Alpha2/Dev-NuPV/PVReplicator2/../Common-Classes/Classes/ 
PVArraySet2.h:18: warning: C++ constructors and destructors will not  
be invoked for Objective-C fields


My question is this: will this Objective C class work properly, given  
that the Smart Pointer's constructors and destructors will not be  
invoked?
If not, how am I supposed to address this?


- Matthew



More information about the Valentina mailing list