对象错误地显示为引用?

Object Incorrectly Showing Up As Reference?

本文关键字:引用 显示 错误 对象      更新时间:2023-10-16

为清楚起见进行了编辑:

我有一个向量向量,allPaths,以及一个向量,路径,我试图将其添加到allPaths中。 allPath 通过引用传递,路径通过值传递到函数中。

当尝试做

allPaths.insert(path);

我收到错误,即使路径是一个值,我也无法添加对 allPath 的引用:

error: no matching function for call to ‘std::vector<std::vector<llvm::Instruction*> >::insert(std::vector<llvm::Instruction*>&)’
allPaths.insert(path);
^

allPaths是一个vector<std::vector<llvm::Instruction*>&。 路径是vector<llvm::Instruction*>

为什么path参数显示为错误中对向量的引用,而不是实际向量?

任何建议将不胜感激!我对C++和LLVM都很陌生,所以我的一些假设也可能是不正确的。

std::vector::insert

对一个参数没有重载。

你的意思是push_back而不是insert

相关文章: