ambiguous overload resolution

I have a class that converts a set of 4 numbers to one number or a set of 5 numbers to a number. It is used to go from one to the other.

I call the one number pixID, and the function I am using is getPixID

from usePlex.h
1
2
  int getPixID(int croc=1, int chain=0, int board=1, int pixel=0);
  int getPixID(int location=1,int mod_frame=74, int view_tower=1, int plane_story=1, int strip_bar=1);


from usePlex.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
int usePlex::getPixID(int croc,int chain, int board, int pixel)
{
  fseek(f,0,SEEK_SET);
  int thiscroc,thischain,thisboard,thispixel;
  int pixID=-1;
  fgets(line,256,f);
  while(fgets(line,256,f))
    {
      sscanf(line,"%d %*d (%d,%d,%d,%d)",&pixID,&thiscroc,&thischain,&thisboard,&thispixel);
      if((thiscroc==croc)&&(thischain==chain)&&(thisboard==board)&&(thispixel==pixel)) break;
    }
  return pixID;
}

int usePlex::getPixID(int location, int mod_frame, int view_tower, int plane_story, int strip_bar)
{
  
  fseek(f,0,SEEK_SET);
  int thislocation,thismod_frame,thisview_tower,thisplane_story,thisstrip_bar;
  int pixID=-1;
  fgets(line,256,f);
  while(fgets(line,256,f))
    {
      sscanf(line,"%d %*d (%*d,%*d,%*d,%*d) (%d,%d,%d,%d,%d)",&pixID,&thislocation,&thismod_frame,&thisview_tower,&thisplane_story,&thisstrip_bar);
      if((thislocation==location)&&(thismod_frame==mod_frame)&&(thisview_tower==view_tower)&&(thisplane_story==plane_story)&&(thisstrip_bar==strip_bar)) break;
    }
  return pixID;
}




Using the 5 argument version works fine, but the 4 argument version results in the ambiguous overload resolution error. 4 seemed distinct from 5, so I don't understand why this is. I'm sure it is something obvious that I don't know yet. Any help would be much appreciated.
It's all those default parameters values.
Any function call where less than 5 parameters are explicitly provided will be ambiguous.
Last edited on
Topic archived. No new replies allowed.