I\'m trying to typedef either an unordered_map or std::map depending whether there are TR1 libraries available. But I don\'t want to specify the template parameters. From wh
You have to use full types for typedefs.
Use a #define macro instead.
The way I've seen this done is to wrap the typedef in a template-struct:
template<typename KeyType, typename MappedType>
struct myMap
{
#ifdef _TR1
typedef std::tr1::unordered_map<KeyType, MappedType> type;
#else
typedef std::map<KeyType, MappedType> type;
#endif
};
Then in your code you invoke it like so:
myMap<key, value>::type myMapInstance;
It may be a little more verbose than what you want, but I believe it meets the need given the current state of C++.