I need to provide configuration file, which will describe which STL header files to include. I have found that usually it is done by defining a lot of HAVE_XXX_HEADER macros. I wonder if there’s something wrong with explicitly providing header name in a macro. Then instead of testing each variant:
#if defined(HAVE_TR1_UNORDERED_MAP_HEADER)
#include <tr1/unordered_map>
#elseif (...)
#endif
you could simply have:
#define UNORDERED_MAP_HEADER <tr1/unordered_map>
(...)
#include UNORDERED_MAP_HEADER
which in addition brings flexibility, since header name is not hard coded inside configured file.
This is possible and legal in C99, cf ISO 9899:1999 §6.10.2 example 2. A similar example can also be found in the (draft) C++ standard, 16.2 bullet 8.