错误解释

CompileError!

编译信息

main.cpp: In function \xe2\x80\x98int main()\xe2\x80\x99:\nmain.cpp:27:75: error: wrong number of template arguments (0, should be 1)\n 27 | priority_queue<tuple<int,int,int>, vector<tuple<int,int,int>>, greater<>> heap;\n | ^\nIn file included from /usr/include/c++/11/string:48,\n from /usr/include/c++/11/bits/locale_classes.h:40,\n from /usr/include/c++/11/bits/ios_base.h:41,\n from /usr/include/c++/11/ios:42,\n from /usr/include/c++/11/ostream:38,\n from /usr/include/c++/11/iostream:39,\n from main.cpp:1:\n/usr/include/c++/11/bits/stl_function.h:385:12: note: provided for \xe2\x80\x98template<class _Tp> struct std::greater\xe2\x80\x99\n 385 | struct greater : public binary_function<_Tp, _Tp, bool>\n | ^~~~~~~\nmain.cpp:27:76: error: template argument 3 is invalid\n 27 | priority_queue<tuple<int,int,int>, vector<tuple<int,int,int>>, greater<>> heap;\n | ^~\nmain.cpp:30:14: error: request for member \xe2\x80\x98emplace\xe2\x80\x99 in \xe2\x80\x98heap\xe2\x80\x99, which is of non-class type \xe2\x80\x98int\xe2\x80\x99\n 30 | heap.emplace(edge.second, 1, edge.first);\n | ^~~~~~~\nmain.cpp:36:18: error: request for member \xe2\x80\x98empty\xe2\x80\x99 in \xe2\x80\x98heap\xe2\x80\x99, which is of non-class type \xe2\x80\x98int\xe2\x80\x99\n 36 | while (!heap.empty() && mst_edges.size() < N - 1) {\n | ^~~~~\nmain.cpp:36:46: warning: comparison of integer expressions of different signedness: \xe2\x80\x98std::vector<std::pair<int, int> >::size_type\xe2\x80\x99 {aka \xe2\x80\x98long unsigned int\xe2\x80\x99} and \xe2\x80\x98int\xe2\x80\x99 [-Wsign-compare]\n 36 | while (!heap.empty() && mst_edges.size() < N - 1) {\n | ~~~~~~~~~~~~~~~~~^~~~~~~\nmain.cpp:37:14: warning: structured bindings only available with \xe2\x80\x98-std=c++17\xe2\x80\x99 or \xe2\x80\x98-std=gnu++17\xe2\x80\x99\n 37 | auto [w, u, v] = heap.top();\n | ^\nmain.cpp:37:31: error: request for member \xe2\x80\x98top\xe2\x80\x99 in \xe2\x80\x98heap\xe2\x80\x99, which is of non-class type \xe2\x80\x98int\xe2\x80\x99\n 37 | auto [w, u, v] = heap.top();\n | ^~~\nmain.cpp:38:14: error: request for member \xe2\x80\x98pop\xe2\x80\x99 in \xe2\x80\x98heap\xe2\x80\x99, which is of non-class type \xe2\x80\x98int\xe2\x80\x99\n 38 | heap.pop();\n | ^~~\nmain.cpp:42:28: error: no matching function for call to \xe2\x80\x98std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)\xe2\x80\x99\n 42 | mst_edges.push_back({u, v});\n | ~~~~~~~~~~~~~~~~~~~^~~~~~~~\nIn file included from /usr/include/c++/11/vector:67,\n from main.cpp:2:\n/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: \xe2\x80\x98void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]\xe2\x80\x99\n 1187 | push_back(const value_type& __x)\n | ^~~~~~~~~\n/usr/include/c++/11/bits/stl_vector.h:1187:35: note: no known conversion for argument 1 from \xe2\x80\x98<brace-enclosed initializer list>\xe2\x80\x99 to \xe2\x80\x98const value_type&\xe2\x80\x99 {aka \xe2\x80\x98const std::pair<int, int>&\xe2\x80\x99}\n 1187 | push_back(const value_type& __x)\n | ~~~~~~~~~~~~~~~~~~^~~\n/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: \xe2\x80\x98void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]\xe2\x80\x99\n 1203 | push_back(value_type&& __x)\n | ^~~~~~~~~\n/usr/include/c++/11/bits/stl_vector.h:1203:30: note: no known conversion for argument 1 from \xe2\x80\x98<brace-enclosed initializer list>\xe2\x80\x99 to \xe2\x80\x98std::vector<std::pair<int, int> >::value_type&&\xe2\x80\x99 {aka \xe2\x80\x98std::pair<int, int>&&\xe2\x80\x99}\n 1203 | push_back(value_type&& __x)\n | ~~~~~~~~~~~~~^~~\nmain.cpp:47:22: error: request for member \xe2\x80\x98emplace\xe2\x80\x99 in \xe2\x80\x98heap\xe2\x80\x99, which is of non-class type \xe2\x80\x98int\xe2\x80\x99\n 47 | heap.emplace(edge.second, v, edge.first);\n | ^~~~~~~\n