47.__if_not_exists语句

Posted 喵小喵~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了47.__if_not_exists语句相关的知识,希望对你有一定的参考价值。

 1 #include <iostream>
 2 using namespace std;
 3 
 4 template<class T>
 5 class myclass
 6 {
 7 public:
 8     T t;
 9     void show(T tx)
10     {
11         cout << tx << endl;
12     }
13 };
14 
15 void main()
16 {
17     /*int num;*/
18 
19     /*__if_exists(num)
20     {
21         cout << "存在" << endl;
22     }*/
23     /*__if_not_exists(num)
24     {
25         cout << "不存在" << endl;
26     }*/
27 
28     myclass<int> t1;
29 
30     //检测某个模板有没有根据某个类型实例化
31     __if_exists(myclass<int>)
32     {
33         cout << "存在" << endl;
34     }
35     cin.get();
36 }

 

以上是关于47.__if_not_exists语句的主要内容,如果未能解决你的问题,请参考以下文章