 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Piotr Guest
|
Posted: Tue Jan 31, 2006 2:00 am Post subject: Compile error |
|
|
I have this compile error and I have narrowed down the following piece
of code.
stddev.cpp:133: error: no matching function for call to
'transform(<unknown type>, <unknown type>,
__gnu_cxx::__normal_iterator<float*, std::vector<float,
std::allocator<float> > >, Div)'
gmake[5]: *** [stddev.o] Error 1
I can't figure it out why, I appreciate if anyone can help.
struct Div
{
public:
Div(int max):_max(max) {}
float operator()(int i)
{
return ((float)i/ _max);
}
private:
int _max;
};
float StatUtils::std_dev_max( vector<int>& v , int max)
{
vector<float> v1(v.size());
transform(v.begin, v.end, v1.begin(), Div(max));
return 0.0;
} |
|
| Back to top |
|
 |
Piotr Guest
|
Posted: Tue Jan 31, 2006 2:00 am Post subject: Re: Compile error |
|
|
Try donig this, but it still does not work:
struct Div : public unary_function<int, float>
{
public:
Div(int max):_max(max) {}
float operator()(int i)
{
return ((float)i/ _max);
}
private:
int _max;
}; |
|
| Back to top |
|
 |
Thomas Tutone Guest
|
Posted: Tue Jan 31, 2006 3:00 am Post subject: Re: Compile error |
|
|
Piotr wrote:
| Quote: | I have this compile error and I have narrowed down the following piece
of code.
stddev.cpp:133: error: no matching function for call to
'transform(<unknown type>, <unknown type>,
__gnu_cxx::__normal_iterator<float*, std::vector<float,
std::allocator<float> > >, Div)'
|
[snip]
| Quote: | vector<float> v1(v.size());
transform(v.begin, v.end, v1.begin(), Div(max));
|
You forgot the "()" after begin and end.
Best regards,
Tom |
|
| Back to top |
|
 |
Piotr Guest
|
Posted: Tue Jan 31, 2006 6:00 am Post subject: Re: Compile error |
|
|
Thanks.
Sorry. That was a stupid of me. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|