私は次のようなファンクターを作成しようとしています:
struct STFRandomTreeFunction
{
typedef double (*function_ptr)(const TrainingDataPoint& data, boost::unordered_map<std::string, cv::Mat>& 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_ptr, std::string function_id){
image_cache = &cache;
this->function = function;
this->function_id = function_id;
}
std::string get_function_id(){
return function_id;
}
double operator()(const TrainingDataPoint& data_point){
return function(data_point, *image_cache);
}
};
そして、次のコードを実行しようとしています。
double something(const TrainingDataPoint& a, unordered_map<string, Mat>& cache){
return 5;
}
int main(int argc, char* argv[]) {
unordered_map<string, Mat> cache;
STFRandomTreeFunctor functor = STFRandomTreeFunctor(cache, something, "id");
TrainingDataPoint d = TrainingDataPoint(1,2,"", ImagePoint(1,2), ImagePoint(1,2), "");
double value = functor(d);
cout << "Value is " << value << endl;
}
ただし、出力がありません。いくつかの例外がスローされているように見えますが、eclipseは例外を表示しておらず、プログラムが終了したことを示しているだけです。
何か案は?