Synthesized ivar for std::tr1::shared_ptr<MyClass>?
Synthesized ivar for std::tr1::shared_ptr<MyClass>?
- Subject: Synthesized ivar for std::tr1::shared_ptr<MyClass>?
- From: Barry Wark <email@hidden>
- Date: Wed, 5 May 2010 23:19:48 -0700
I'm no C++ guru, so I'm hoping someone can help me by explaining why
the following gives a compiler error:
//MyObjC.h
@interface MyObjC : NSObject {}
@end
//MyObjC.mm
#import "MyObjC.h"
#include "MyClass.h" //provides MyClass, a C++ class
#include <tr1/memory>
using std::tr1::shared_ptr;
@interface MyObjC ()
@property (assign, readwrite, nonatomic) shared_ptr<MyClass> foo;
@end
@implementation MyObjC
@synthesize foo; // gives compiler error: instance variable 'foo' has
unknown size
@end
The definitions for both shared_ptr and MyClass are available, as far
as I can tell. Furthermore, the following compiles without error:
//MyObjC.h
#include <tr1/memory>
#include "MyClass.h"
@interface MyObjC : NSObject
{
std::tr1::shared_ptr<MyClass> foo;
}
@end
//MyObjC.mm
#import "MyObjC.h"
#include "MyClass.h" //provides MyClass, a C++ class
#include <tr1/memory>
using std::tr1::shared_ptr;
@interface MyObjC ()
@property (assign, readwrite, nonatomic) shared_ptr<MyClass> foo;
@end
@implementation MyObjC
@synthesize foo; // gives compiler error: instance variable 'foo' has
unknown size
@end
Thus, I'm lead to believe this is an issue with runtime synthesizing
of the ivar, but I'm at a loss to explain why it should be so. I would
like to keep the C++ out of the header file if possible so that I can
use standard Objective-C when importing the header file in client
modules.
Any guidance from C++ gurus?
Thanks,
Barry
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden