我可能做错了什么。有人可以向我解释一下到底是什么吗?
在 SemanticNodeFactory 类的某个地方,我有:
std::pair<C_ptr,R_ptr> Find( Token token )
{
C_ptr concept = nullptr;
R_ptr relation = nullptr;
//concept = concept_map->Find( token ); <- This works
//relation = relation_map->Find( token ); <- And this too
std::thread t1 ( [&concept,this] ( Token token ) { concept = concept_map->Find( token ); } );
std::thread t2 ( [&relation,this] ( Token token ) { relation = relation_map->Find( token ); } );
实际调用的方法属于:
typedef std::shared_ptr<Relation> R_ptr;
typedef std::shared_ptr<Concept> C_ptr;
std::shared_ptr<SemanticGraph<Relation>> relation_map;
std::shared_ptr<SemanticGraph<Concept>> concept_map;
但是,编译器抱怨说:
error: no match for call to ‘(SemanticNodeFactory::Find(Token)::<lambda(Token)>) ()’
note: candidate is:
note: SemanticNodeFactory::Find(Token)::<lambda(Token)>
但是,我试图调用的实际方法实际上是:
SemanticGraph<Relation>::Find(Token)
SemanticGraph<Concept>::Find(Token)
我究竟做错了什么?我通过引用捕获了这个局部变量,但它似乎抱怨实际的方法?