Improve Multiplatform Code With __has_include and Feature Test Macros

1 · Bartłomiej Filipek · July 22, 2019, 5:21 a.m.
Two weeks ago, I showed you a sample that can detect if a function has a given overload. The example revolved around std::from_chars - low-level conversion routine for C++17. In the example, some “heavy” template patterns helped me to write the final code (most notably std::void_t and if constexpr). Maybe there are some other techniques we can use to check if a feature is available or not? Today I’d like to have a look at __has_include and discuss the upcoming feature test macros that we’ll h...