First of all, I read this question: Is there a way to detect portable that the standard header is enabled using macros?
And I want to know: how safe is it to use #ifdef for the detection task if the std C ++ header is included, as in the code below:
namespace overwrite { using byte = unsigned char; template <bool safeMode = true, typename generic> void withZeros( generic *toBeOverwriten, size_t length = 1 ) {
... so I could not just overload some std function as the βworst matchβ as suggested in the answer to the above question, but also compile or not the whole function / section of my header file, depending on the inclusion of some std header .
Isn't it generally safe, as I suspect? If so, are there other ways to detect this in order to do what I want?
As for "Why the hell am I just not including the headline" ...
The code I give as an example of what I'm trying to do is just an example. I had other things in my mind, and I just wanted to know if there is another way to check for the inclusion of headers without checking the macros that you expect to define inside them. Then I remembered this real situation, when I asked myself about it, and I started by asking what I was asking ... because in this case I do not want to include a lot of code ( <random> longer than 20 or 30 LOC) to "support" one function of my header.
source share