c++11 - Determine compile-time existence of include files in C++ -
I am trying to write some portable C ++ library codes which will initially depend on Boost. Regions, and then TR1 support compilers, and eventually things for the C ++ 0x specification are transferred from std :: tr1 namespace to STD. Here are some pseudo codes that I have to do with the preprocessor:
if (exists (regex)) // Check whether I am #include & lt; Regex & gt; {#include & lt; Regex & gt; // per TR1 if (is_namespace (std :: tr1)) // Are we on TR1 or C ++ 0x? Using {Std :: tr1 :: regex; } Else {std :: regex; }} And // {# include & lt; Boost / regex.hpp & gt; Boost :: using regex; }
Valid, that everyone should be in the preprocessor instructions, but if I knew how to complete it that I would not be asking here.
You can not do this without the relation of a third party before Preprocessing generally, things like autoconf
can be used to complete it
with the #define
instructions Another header works by generating a file that shows the existence of the header / libraries that you want to use.
Comments
Post a Comment