I would like to use the TR1 libraries that ship with modern versions of GCC and MSVC, but there are subtle differences: in GCC, I have to say
#include <tr1/memory>
std::tr1::shared_ptr<int> X;
while in MSVC I have to say
#include <memory>
std::shared_ptr<int> X;
I have two questions: 1) Does MSVC automatically operate in C++0x-mode (equivalent to GCC's std=c++0x), or does it also work in C++98/03 mode by default? 2) How can I unify the includes and namespaces? I was thinking about a preprocessor macro of the sort "INCLUDE_TR1(memory)" or something like that.
To clarify, I want to use the traditional, standard C++98/03; not C++0x (otherwise there'd be no problem).
I'd be most grateful for any suggestions!
std::result_of<>
uses the TR1 result_of protocol instead of being decltype
-based); in fact, much of the standard library in VC++ 2010 is not actually defined in namespace std
, but rather in namespace std::tr1
and pulled into namespace std
with a using directive.#include
the appropriate headers according to your platform, or if your platform doesn't have TR1 support, #include
the corresponding Boost implementations and pull them into namespace std::tr1
with using declarations.