c++ value_type not work for std::tr1:tuple in a std::map
问题 The following code snippet work with Visual Studio 2008 but not with Visual Studio 2010. template <typename TKey> struct MyStruct { typedef std::map<TKey, int> Keys; MyStruct() { } void set(TKey& key) { #if 1 // This works with VS 2008 but not with 2010 keys_.insert(typename Keys::value_type(key, 1)); #else // This works with VS 2008 and VS 2010 keys_.insert(std::pair<TKey, int>(key, 1)); #endif }; private: Keys keys_; }; Usage typedef std::tr1::tuple<int, int> MyValueType; MyStruct