C++: __has_include
개요
- 헤더/소스 파일을 포함 가능 여부 확인
예제
- 코드
#if __has_include(<abcdefg>)
#include <abcdefg>
constexpr int has = 1;
#elif __has_include(<abcdefg/hij>)
#include <abcdefg/hij>
constexpr int has = 2;
#else
constexpr int has = 3;
#endif
#include <iostream>
using namespace std;
int main() {
cout << has << endl;
return 0;
}
- 실행 결과
3