title: error because of ambiguity in template function declaration
body: <p>I am using some function templates in order to store data generically and per type.</p>
  
  <p>I defined my <code> template&lt;class T&gt; store() </code> functions like below.</p>
  
  <p>If I call the functions explicitly with the type <code>uint64_t</code></p>
  
  <pre><code>store&lt;uint64_t&gt;( &amp;p, my_value );
  </code></pre>
  
  <p>I receive a compile time error saying</p>
  
  <pre><code>    call of overloaded 'store(char**, uint64_t&amp;)' is ambiguous
      candidates are: 
               void store(char**, T) [with T = long unsigned int]
               void store(char**, T2) [with T1 = long unsigned int, 
                                            T2 = long unsigned int]
  </code></pre>
  
  <p>If instead I write it without type I have no error ( compiler is inferring the type ).</p>
  
  <pre><code>   store( &amp;p, my_value );
  </code></pre>
  
  <p>I noticed that the compiler is assuming a function having the second argument passed by reference, while my template declaration the second argument must be copied.
  Do you know why this happened and what to do to solve this ambiguity or being more clear at type declaration?</p>
  
  <p>Best Regards</p>
  
  <p>AFG</p>
  
  <pre><code>template&lt; class T &gt;
  inline void store( char** buffer, T data ){
  
      memcpy( *buffer, &amp;data, sizeof( T ) );
      buffer += sizeof(T);
  }
  
  
  template&lt; class T1, class T2 &gt;
  inline void store( char** buffer, T2 data ){    
  
      memcpy( *buffer, &amp;data, sizeof( T1 ) );
      buffer += sizeof(T1);
  }
  </code></pre>