title: c++ "error: no matching function for call to" when count in a set
body: <p>I'm implementing a map using a set and a Tuple class which i made as an exercise and i keep getting this error: <code>error: no matching function for call to 'std::set&lt;Tuple&lt;int, char&gt;, std::less&lt;Tuple&lt;int, char&gt; &gt;, std::allocator&lt;Tuple&lt;int, char&gt; &gt; &gt;::count(Tuple&lt;char, int&gt;&amp;)</code> </p>
  
  <p>this is my code:</p>
  
  <pre><code>        template &lt;class K,class V&gt; class Tuple
  {
  private:
      K* mKey;
      V* mValue;
  public:
      Tuple(const K&amp; key, const V&amp; val)
      {
          mKey = &amp;key;
          mValue = &amp;val;
      };
  
      Tuple(const K&amp; key)
      {
          mKey = &amp;key;
      };
      const K&amp; getKey()
      {
          return *mKey;
      };
      const V&amp; getValue()
      {
          return *mValue;
      };
      void setKey(const K&amp; key)
      {
          mKey=&amp;key;
      };
      void setValue(const V&amp; val)
      {
          mValue=&amp;val;
      };
      bool operator&lt; (Tuple&lt;K,V&gt;&amp; t)
      {
          return *mKey&lt;*t.mKey;
      };
      bool operator== (Tuple&lt;K,V&gt;&amp; t)
      {
          return *mKey==*t.mKey;
      };
  };
  
  template &lt;class K,class V&gt; class map
  {
  private:
      set&lt;Tuple&lt;K,V&gt; &gt;* mTupleMap;
  
  public:
      map()
      {
          mTupleMap = new set&lt;Tuple&lt;K,V&gt; &gt;;
      };
  
      void insert(const K&amp; key,const V&amp; val)
      {
          Tuple&lt;V,K&gt; tmp(key,val);
          if(mTupleMap-&gt;count(tmp)!=0)
          {
              typename set&lt;Tuple&lt;K,V&gt; &gt;::iterator it;
              it=mTupleMap-&gt;find(tmp);
              (*it).setValue(val);
          }
          else
          {
              mTupleMap-&gt;insert(tmp);
          }
      }
      const V&amp; getValue(const K&amp; key)
      {
          set&lt;V,K&gt; tmp(key);
          if(mTupleMap-&gt;count(tmp)!=0)
          {
              typename set&lt;Tuple&lt;K,V&gt; &gt;::iterator it;
              it=mTupleMap-&gt;find(tmp);
              return (*it).getValue();
          }
          return NULL;
      }
  };
  
  int main()
  {
      map&lt;int,char&gt; mapIntToChar;
      mapIntToChar.insert(1,'a');
      mapIntToChar.insert(2,'b');
      mapIntToChar.insert(1,'c');
      cout &lt;&lt; mapIntToChar.getValue(1) &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>I have no idea what's the problem or how to solve it so I'll like to get some help.</p>