C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compile error

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Piotr
Guest





PostPosted: Tue Jan 31, 2006 2:00 am    Post subject: Compile error Reply with 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)'
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





PostPosted: Tue Jan 31, 2006 2:00 am    Post subject: Re: Compile error Reply with quote



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





PostPosted: Tue Jan 31, 2006 3:00 am    Post subject: Re: Compile error Reply with quote



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





PostPosted: Tue Jan 31, 2006 6:00 am    Post subject: Re: Compile error Reply with quote

Thanks.

Sorry. That was a stupid of me.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.