我在我的代码中发布了一个问题,其唯一的#include指令如下:
#include <bits/stdc++.h>
Run Code Online (Sandbox Code Playgroud)
我的老师告诉我这样做,但在评论部分,我被告知我不应该这样做.
为什么?
c++ portability c++-faq turbo-c++ implementation-defined-behavior
我正在尝试unordered_map使用整数创建一个映射对:
#include <unordered_map>
using namespace std;
using Vote = pair<string, string>;
using Unordered_map = unordered_map<Vote, int>;
Run Code Online (Sandbox Code Playgroud)
我有一个班级,我已宣布Unordered_map为私人会员.
但是,当我尝试编译它时,我收到以下错误:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:948:38:未定义模板的隐式实例化'std :: __ 1 :: hash,std :: __ 1: :basic_string >>'
如果我使用常规地图map<pair<string, string>, int>而不是使用,我没有收到此错误unordered_map.
是否无法pair在无序地图中使用密钥?
c++ ×2
c++-faq ×1
dictionary ×1
implementation-defined-behavior ×1
keyvaluepair ×1
portability ×1
turbo-c++ ×1