Closed Idclip closed 2 years ago
What is its advantage compared to #include
?
How does this compare to import
introduced in C++20 ?
@balaji-ch It's a bit different than #include
; this just checks for the existence of a header file. cppreference has a good example where you can use __has_include
to determine if the compiler has a standard \<optional> header available, or to fallback to an experimental one.
I'm not too familiar with modules yet but I believe import
is just the modules version of #include
, in other words, does something different than __has_include
.
Is this issue still up from grabs ?
If that is so then I am willing to work on it and add necessary documentation about the __has_include
operator, along with some examples of the same.
@Arsenic-ATG yes it is, PRs are welcome, just make sure to look at https://github.com/AnthonyCalandra/modern-cpp-features/blob/master/CONTRIBUTING.md#pull-requests first.
__has_include
was introduced in C++17. Might be nice to include it (no pun intended): https://en.cppreference.com/w/cpp/preprocessor/include