sách gpt4 ăn đã đi

c++ - ‘internalPath’(类型 ‘std::string {aka std::basic_string}’)到类型 ‘std::basic_string&&’

In lại 作者:搜寻专家 更新时间:2023-10-31 02:23:54 26 4
mua khóa gpt4 giày nike

我在函数的代码行下面运行

string internalPath(os.str());
m_tags.insert(make_pair(internalPath, tagConfig ));
error: no matching function for call to ‘make_pair(std::string&, const wicom::TagConfig&)’
m_tags.insert(make_pair(internalPath, tagConfig ));
^

编译器 g++=C++14

câu trả lời hay nhất

您永远不应该为 std::make_pair 明确指定模板参数——它旨在推导它们,因为它使用完美转发。要么摆脱它们:

m_tags.insert(make_pair(internalPath, tagConfig ));

或者如果您需要明确指定它们,请直接使用 cặp std:::

m_tags.insert(pair(internalPath, tagConfig ));

作为旁注,您似乎有using namespace std;某处。我建议你摆脱它,它比其他任何东西都更令人困惑。

关于c++ - ‘internalPath’(类型 ‘std::string {aka std::basic_string}’)到类型 ‘std::basic_string&&’,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28744057/

26 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress