请告诉我代码有什么问题以及我应该更改什么来修复它(我收到编译错误):
#include <algorithm>
#include <cstring>
using namespace std;
const int MMAX = 1000001;
//--------------------------------------------------------------------------------------------
inline bool comp(int &A, int &B) {
if (A < B) return true;
return false;
}
template<typename _CompareFunction>
struct myHeap { // min-heap
_CompareFunction cmp;
};
//--------------------------------------------------------------------------------------------
myHeap< comp > H;
int main() {
}
提前谢谢了!
编辑:编译错误:
heap_minimal.cpp:19:15: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _CompareFunction> struct myHeap’
heap_minimal.cpp:19:15: error: expected a type, got ‘comp’
heap_minimal.cpp:19:18: error: invalid type in declaration before ‘;’ token
(用 C++11 编译)