Quantcast
Channel: Bartek's coding blog
Viewing all articles
Browse latest Browse all 325

Improve Multiplatform Code With __has_include and Feature Test Macros

$
0
0

Multiplatform code and __has_include, C++17

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 have in C++20.

Read more...

Viewing all articles
Browse latest Browse all 325

Trending Articles