[SG10] __has_include
Richard Smith
richard at metafoo.co.uk
Wed Jun 19 21:11:02 CEST 2013
Starting with an example, here's how the new C++14 headers could be
detected and used:
#ifndef __has_include
#define __has_include(x) 0
#endif
#if __has_include(<optional>)
#include <optional>
#endif
#if __has_include(<dynarray>)
#include <dynarray>
#endif
Specification:
__has_include is a predefined function-like macro.
__has_include(pp-tokens) expands to 1 if the preprocessing directive
#include pp-tokens
would identify a header or source file (16.2/1). Otherwise, it expands to 0.
Clang's documentation for __has_include is at
http://clang.llvm.org/docs/LanguageExtensions.html#include-file-checking-macros
More information about the Features
mailing list