我有以下代码:C++:tusing升压unordered_map错误:没有匹配的函数调用
结构STFRandomTreeFunction { 的typedef双(* function_ptr)(常量STFDataPoint &数据,助推:: unordered_map & preloaded_images); };
struct STFRandomTreeFunctor
{
private:
boost::unordered_map<std::string, cv::Mat> *image_cache;
STFRandomTreeFunction::function_ptr function;
std::string function_id;
public:
STFRandomTreeFunctor(boost::unordered_map<std::string, cv::Mat>& cache, STFRandomTreeFunction::function_ptr function, std::string function_id)
:image_cache(&cache), function(function), function_id(function_id){}
std::string get_function_id(){
return function_id;
}
double operator()(const TrainingDataPoint& data_point){
return function(data_point, *image_cache);
}
};
unordered_map<string, STFRandomTreeFunctor> lut;
double a(const STFDataPoint& b, unordered_map<string, Mat>& c){
return 5;
}
int main(int argc, char* argv[]) {
unordered_map<string, Mat> cache;
lut["a"] = STFRandomTreeFunctor(cache, a, "a");
}
当我尝试建立我得到以下错误:boost/unordered/detail/allocate.hpp:262:1: error: no matching function for call to ‘STFRandomTreeFunctor::STFRandomTreeFunctor()’
但我不知道为什么升压试图调用STFRandomTreeFunctor()
,这是因为当我们创建空的映射,它试图创建一个STFRandomTreeFunctor?如果是这样,我该如何解决这个问题?
感谢
噢,对不起,我只是复制他们在错误的,结构是其中包含的头文件实际上定义,我会编辑帖子以反映这一点 – Aly