Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以可以说我有:map<pair<int, MyEnum>, string> myMap;
map<pair<int, MyEnum>, string> myMap;
我添加了一个键值:myMap[make_pair(1, MyEnum::first)] = "something";
myMap[make_pair(1, MyEnum::first)] = "something";
如何检索“某物”的值
所以如果地图是map<int, string>并且我有myMap[1] = "something";
map<int, string>
myMap[1] = "something";
我会说string s = myMap[1]
string s = myMap[1]
同样的方式,
std::cout << myMap[make_pair(1, MyEnum::first)] << std::endl;
输出:
something
希望有帮助。
string s = myMap[make_pair(1, MyEnum::first)];