Hi!
I have two simple functions like this:
bool within(int var, int min, int max){
if (var>=min && var<=max)
return true;
else
return false;
}
bool within(float var, float min, float max){
if (var>=min && var<=max)
return true;
else
return false;
}
Calling it like this gives me "Error 2 error C2666: 'within' : 2 overloads have similar conversions
float foo = 0.4;
if(within(foo, 0, 1))
bar();
I know i can specify constants to be float like so : (within(foo, 0f, 1f)) but i remember I earlier didnt have to do this and I use this ALL over in my projects and now suddenly has loads of compilation errors.
Can I write this in some way that it just accepts (float, something, something) and that would use the second function? (the one that works with floats?)
Thanks!
Erik
↧