我正在尝试typedef一个无序映射或std :: map,这取决于是否有TR1库。但我不想指定模板参数。到目前为止,根据我所读的,非官方c ++ 0x标准发布之前,未能使用模板来进行typedef是不可能的。那么,有人知道这个的优雅解决方法吗?
#ifdef _TR1
#include <unordered_map>
typedef std::tr1::unordered_map MyMap; //error C2976: too few template arguments
#else
#include <map>
typedef std::map MyMap; //error C2976: too few template arguments
#endif