title: Determine compile-time existence of include files in C++
body: <p>I'm trying to write some portable C++ library code that will initially rely on Boost.Regex, and then move to TR1 as compilers support it, and eventually to the C++0x specification after things get moved from the std::tr1 namespace to std. Here is some pseudo-code for what I'd like to do with the preprocessor:</p>
  
  <pre><code>if( exists(regex) )    // check if I can #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
      {
          using std::regex;
      }
  } else    // fall-back to boost
  {
      #include &lt;boost/regex.hpp&gt;
      using boost::regex;
  }
  </code></pre>
  
  <p>Granted, all of that would need to be in preprocessor directives, but if I knew how to accomplish that I wouldn't be asking here. :)</p>