How does one include TR1?

后端 未结 6 1123
花落未央
花落未央 2021-02-03 22:58

Different compilers seem to have different ideas about TR1. G++ only seems to accept includes of the type:

#include 
#include 

        
6条回答
  •  一个人的身影
    2021-02-03 23:22

    Perhaps the best way would be to simply use boost libraries for now, as in many cases they have alternatives with a similar interface to TR1 features, and are just in a different (but consistent) header path and namespace. This has the advantage of working on compilers that haven't even begun implementing C++0x. And there are plenty of useful boost libraries that aren't in TR1 at all :)

    Alternately, on G++, you could try passing --std=gnu++0x on the command line. This works for and , at least. Then to make it available in std::tr1:

    namespace std { namespace tr1 { using namespace std; } }
    

    This is evil, naturally. I highly recommend the boost approach instead :)

提交回复
热议问题