title: error: no match for ‘operator<’ in ‘__x < __y’ when trying to insert in two map
body: <p>In code there are two map.One store pair and other store where Values is class with 5 variable with data type string,int,string,int,int.but during inserting in the second map i am getting error g++ error: no match for ‘operator&lt;’ in ‘__x &lt; __y’ when trying to insert in map. (Note Keys and Values in first map changes to Values,Key in second map)</p>
  
  <p>How to solve it.</p>
  
  <pre><code>class Values
  {
  private:
      std::string C_addr;
      int C_port;
      std::string S_addr;
      int S_port;
      int C_ID;
  
  public:
      Values(std::string,int,std::string,int,int);
      void printValues();
  };
  
  
  Values :: Values(std::string Caddr,int Cport,std::string Saddr,int Sport,int Cid)
  {
      C_addr=Caddr;
      C_port=Cport;
      S_addr=Swaddr;
      S_port=Sport;
      C_ID=Cid;
  }
  
  void Values::printValues()
  {
      cout &lt;&lt; C_addr&lt;&lt;":" &lt;&lt;C_port&lt;&lt;":" &lt;&lt; S_addr &lt;&lt;":" &lt;&lt;S_port &lt;&lt; ":"&lt;&lt;C_ID  &lt;&lt;endl;
  }
  
  
  map&lt;int, Values&gt; items;
  map&lt;Values,int&gt; itemscopy;
  
  Values connection (inet_ntoa(Caddr.sin_addr),ntohs(Caddr.sin_port),inet_ntoa(Saddr.sin_addr),ntohs(Saddr.sin_port),CID);
  
  
  for(unsigned int key=0;key&lt;=30000;    )
  {
      map&lt;int,Values&gt;::const_iterator itemsIterator=items.find(key);
  
      if(itemsIterator==items.end())
      {
          items.insert(pair&lt;int, Values&gt; (key, connection));
          {
              map&lt;Values,int&gt;::const_iterator itemsIterator1;
              if(itemsIterator1==itemscopy.end())
                  itemscopy.insert(pair&lt;Values,int&gt; (connection, key));
          }
      break;
      }
      else
      {
          cout&lt;&lt;"already exist";
          key=key+1;
      }
  }
  </code></pre>