title: C++: pass typedef struct pointer to function, get ambiguous errors
body: <p>The code passes <code>typedef struct</code> by pointer, but error happened</p>
  
  <p>The code:</p>
  
  <p>define the <code>typedef struct</code></p>
  
  <pre><code>typedef struct MemBuffer
  {  
    unsigned    char *buffer;  
    unsigned    char *position;  
    size_t      size;  
  } MemBuffer;  
    ...
  </code></pre>
  
  <p>the class head file</p>
  
  <pre><code>class Request
  {
  private:
    void MemBufferGrow(MemBuffer *b)
    void MemBufferAddByte(MemBuffer *b, unsigned char byt);  
    ...
  } 
  </code></pre>
  
  <p>the class <code>.cpp</code> file</p>
  
  <pre><code>void Request::MemBufferGrow(MemBuffer *b)  
  {  
    size_t sz;  
    sz = b-&gt;position - b-&gt;buffer;  
    b-&gt;size = b-&gt;size *2;  
    b-&gt;buffer =(unsigned    char *) realloc(b-&gt;buffer,b-&gt;size);  
    b-&gt;position = b-&gt;buffer + sz;    
  }  
  
  void Request::MemBufferAddByte(MemBuffer  *b,unsigned char byt)
  {  
    if( (size_t)(b-&gt;position-b-&gt;buffer) &gt;= b-&gt;size )  
      MemBufferGrow(b);  //at this line, I get that ambiguous error
  
    *(b-&gt;position++) = byt;  
  }  
  </code></pre>
  
  <p>inside the function:</p>
  
  <pre><code>void Request::MemBufferAddByte(MemBuffer  *b,unsigned char byt)
  </code></pre>
  
  <p>when <code>MemBufferGrow(b)</code> is called, the error happened,</p>
  
  <p>'MemBufferGrow' is ambiguous ' Candidates are: void MemBufferGrow(MemBuffer *) '</p>