(iphone) is it ok to define @property for a c++ class/struct? -


i mixing c++ , objectc.
in particular, i'm adding c++ class/struct variable object-c header, , if legit?

for example,

@interface myview : uiview {    mycppclass  cppvariable; }  @property (nonatomic, assign) mycppclass cppvariable; @end 

and @ implementation file, @synthesize cppvariable; well.

as described in this official document on objective-c++, can have non-pointer c++ objects inside objective-c classes. correctly constructed , destructed, if use option -fobjc-call-cxx-cdtors in gcc / clang.

the situation @sythesizing non-pointer c++ @property not clear, because documentation lacking. behavior depends on compiler used, discussed e.g. in this question. clang team trying implement right thing, don't think it's available now.

so, stick using pointer c++ classes if want @synthesize. otherwise, implement own setter , getter.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -