希望这对我来说只是一个愚蠢的错误。这是我第一次尝试多线程,所以我不知道自己在做什么。
这是有问题的代码(在我的红黑树上):
pair<unsigned long long, unsigned long long> ALTNode::height() {
pair<unsigned long long, unsigned long long> hl(0,0), hr(0,0), f;
future<pair<unsigned long long, unsigned long long>> l, r;
if (left)
l = async(std::launch::async,left->height());
if (right)
r = async(std::launch::async,right->height());
if (left)
hl = l.get();
if (right)
hr = r.get();
f.first = ((hl.first < hr.first) ? hl.first : hr.first) + 1;
f.second = ((hl.second > hr.second) ? hl.second : hr.second) + 1;
return f;
}
以下是生成的错误:
你可以帮帮我吗?错误1错误C2664:&#39; std :: pair&lt; _Ty1,_Ty2&gt; :: pair(const 的std ::对&LT; _Ty1,_Ty2&GT; &安培;)&#39; :无法转换参数1 &#39;的std :: _ Do_call_ret&LT; _Forced,_ret,_Funx,_Btuple,_Ftuple&GT; ::类型&#39;至 &#39; const std :: pairu_Ty1,_Ty2&gt; &安培;&#39; G:\ Visual Studio 2012 \ VC \ include \ xrefwrap 431 1 ALT-Tree