__if_exists keyword in microsoft c++
__if_exists allows you to check a class have member or not. __if_exists用于检查类中是否存在某成员
__if_exists(class::member)
标签:
windows
日期: 2016-04-22 17:30:06, 9 years and 211 days ago
__if_exists allows you to check a class have member or not. __if_exists用于检查类中是否存在某成员
__if_exists(class::member)
通过阅读官方手册进行学习是自我提高的捷径。
MSDN的一般结构为:
super topic
\
+ topic - Overview -+- About
| |
| +- Using
| |
| +- Reference
+--- relation topics
每个主题都有一个Overview,以摘要形式简单介绍主题的相关内容。
每个主题都包含: 关于about 用法using 参考reference 三部分。
以GDI文档为例:https://msdn.microsoft.com/en-us/library/vs/alm/dd145071.aspx.aspx)
... > Archive > Graphics > Windows GDI
-------------------------------------------+-----------------------------------
|Multiple Display Monitors is ....
... |
v Multiple Display Monitors |
v About Multiple Display Monitors |
The Virtual Screen |
... |
> Using Multiple Display Monitors |
> Multiple Display Monitors Reference |
|
顶部为其父主题,左侧为此主题的章节部分。右侧为此主题的概述。
lib staticlibrary.lib /List
lib staticlibrary /EXTRACT:membername
objdump -S membername.obj > membername.asm
Swift类定义前加入@objc关键字,并使类继承自NSObject
@objc class S : NSObject{
func m() {
print(__FUNCTION__)
}
}
头文件具体的名字可在 设置选项:
{project} - {targets} - {build settings} - {swift compiler - code generation} - {Objective-C Generated Interface Header Name}

#import "objc_swift-Swift.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
S* s = [[S alloc]init];
[s m];
}
return 0;
}

选择Create Bridging Header
{project} - {targets} - {build settings} - {swift compiler - code generation} - {Objective-C Bridging Header}
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import "O.h"
.h 文件
@interface O : NSObject -(void)m; @end
.m 文件
@implementation O
-(void)m {
NSLog(@"%s", __FUNCTION__);
}
@end
swift 文件
@objc class S : NSObject{
let o:O = O()
func m() {
o.m()
print(__FUNCTION__)
}
}