title: No matching member for insert on unordered_set
body: <p>I tried to insert a <code>Movie</code> object to the <code>unordered_set&lt;Movie&gt;</code> container, but I got an error saying that there is no such a matching member function. I did something like this</p>
  
  <pre><code>void ActorGraph::addActor(string actor_name, string movie_title, int movie_year){
      unordered_map&lt;string, unordered_set&lt;ActorNode&gt;&gt;::iterator con_itr = connections.find(actor_name);
      ActorNode actor(actor_name);
      Movie movie(movie_title, movie_year);
  
      if(con_itr != connections.end()){
          auto adjSet = con_itr-&gt;second;
          unordered_set&lt;ActorNode&gt;::iterator act_itr = adjSet.find(actor);
          if(act_itr != adjSet.end()){
              //in the set
              auto mov_itr = act_itr-&gt;movies.find(movie);
              if( mov_itr == act_itr-&gt;movies.end()){
                  act_itr-&gt;movies.insert(movie) //no matching function, while act_itr-&gt;movies is of type unordered_set&lt;Movie&gt;
              }
          }
      }else{
          unordered_set&lt;ActorNode&gt; adjSet;
          actor.movies.insert(movie);
          adjSet.insert(actor);
          connections[actor_name] = adjSet;
          cout &lt;&lt; "The size is: " &lt;&lt; actor.movies.size() &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>My ActorNode is a struct which looks like this</p>
  
  <pre><code>struct ActorNode{
      //the name of the actor/actress
      string name;
  
      /** the movie that this actor/actree participated in
       */
      unordered_set&lt;Movie&gt; movies;
  
      ActorNode(string n) : name(n){}
  
      bool operator ==(const ActorNode &amp;other) const;
  };
  
  
  namespace std
  {
      template &lt;&gt;
      struct hash&lt;ActorNode&gt;
      {
          size_t operator()(const ActorNode&amp; actor) const
          {
              return hash&lt;std::string&gt;{}(actor.name);
          }
      };
  }
  </code></pre>
  
  <p>Movie struct</p>
  
  <pre><code>#ifndef Movie_h
  #define Movie_h
  
  #include &lt;iostream&gt;
  using namespace std;
  
  struct Movie{
      string name;
      int year;
      Movie(string n, int y): name(n), year(y){}
      bool operator ==(const Movie &amp;m) const;
  };
  
  
  
  namespace std
  {
      template &lt;&gt;
      struct hash&lt;Movie&gt;
      {
          size_t operator()(const Movie&amp; movie) const
          {
              return hash&lt;std::string&gt;{}(movie.name + to_string(movie.year));
          }
      };
  }
  
  
  #endif /* Movie_ph*/
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RiB9j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RiB9j.png" alt="enter image description here"></a></p>
  
  <p>I have implemented and overrode the operator and make both my Movie and ActorNode struct compatible for using in the key of unordered_set</p>
  
  <p>Here is the repository: 
  <a href="https://github.com/kesongxie/SixDegrees" rel="nofollow noreferrer">Repo</a></p>
  
  <hr>
  
  <p><a href="http://ideone.com/xY8rPd" rel="nofollow noreferrer"><strong>Minimal Reproduction Example</strong></a></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;unordered_set&gt;
  
  struct Movie{
      std::string name;
      int year;
  
      Movie(std::string n, int y): name(std::move(n)), year(y)
      {
      }
  
      bool operator ==(const Movie &amp;m) const
      {
          return year == m.year &amp;&amp; name == m.name;
      };
  };
  
  
  namespace std
  {
      template &lt;&gt;
      struct hash&lt;Movie&gt;
      {
          size_t operator()(const Movie&amp; movie) const
          {
              return hash&lt;std::string&gt;{}(movie.name + to_string(movie.year));
          }
      };
  }
  ////////////////////
  
  struct ActorNode
  {
      std::string name;
      std::unordered_set&lt;Movie&gt; movies;
  
      ActorNode(std::string n) : name(std::move(n))
      {
      }
  
      bool operator ==(const ActorNode &amp;other) const
      {
          return name == other.name;
      }
  };
  
  
  namespace std
  {
      template &lt;&gt;
      struct hash&lt;ActorNode&gt;
      {
          size_t operator()(const ActorNode&amp; actor) const
          {
              return hash&lt;std::string&gt;{}(actor.name);
          }
      };
  }
  ////////////////////
  
  
  int main()
  {
      std::unordered_set&lt;ActorNode&gt; actors;
      actors.emplace("Gene Wilder");
  
      auto itr = actors.find(ActorNode("Gene Wilder"));
      if (itr != actors.end())
      {
          // error: no matching function for call to                  
          //  'std::unordered_set&lt;Movie&gt;::insert(Movie) const'
          itr-&gt;movies.insert(Movie("Stir Crazy", 1980)); 
      }
  }
  </code></pre>