mercredi 4 mars 2015

Functor compile time error

My code -



#include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;

#include "boost\numeric\ublas\matrix.hpp"

typedef boost::numeric::ublas::matrix<float> matrix;


class FillMat{
public:
FillMat(float valIn) : val(valIn){}
float operator()(float in) {
val = in + 1;
return val;
}
private:
float val;
};

typedef boost::numeric::ublas::matrix<float> matrix;
int main(){
matrix m1(10, 20);
float init = 22.2;
FillMat myFiller(init);

generate(m1.begin2(), m1.begin2() + m1.size1()*m1.size2(), myFiller);


return 0;
}


When I try to compile the code, I get the following compile time error.



Error 3 error C2064: term does not evaluate to a function taking 0 arguments


Can someone please tell me why?


P.S. I added the headers. I am using Boost matrix for 2D array.


Aucun commentaire:

Enregistrer un commentaire