title: unordered_map insert error C++
body: <p>I am trying to insert into an unordered_map with a std::set value declared as such:</p>
  
  <pre><code>class Database {
  ...
  private:
      struct CountryRCID {
          int RCID;
          int Vote;
      };
      struct comp {
          bool operator() (const CountryRCID&amp; left, const CountryRCID&amp; right) const {
              return left.RCID &lt; right.RCID;
          }
      };
      std::unordered_map&lt;const char*, std::set&lt;CountryRCID, comp&gt; &gt; CNTVotes;
  };
  </code></pre>
  
  <p>In the Database constructor I am reading data in from a file and attempting to insert into the unordered_map</p>
  
  <pre><code>Database() {
      char CNT[3];
      CountryRCID RCIDVote;
      ... Insert data into CNT and RCIDVote ...
      CNTVotes.insert(std::make_pair(CNT, RCIDVote));
  }
  </code></pre>
  
  <p>And I have attempted compiling the code with both:</p>
  
  <pre><code>g++ main.cpp -std=gnu++0x
  </code></pre>
  
  <p>and</p>
  
  <pre><code>g++ main.cpp -std=c++0x
  </code></pre>
  
  <p>But am receiving the error:</p>
  
  <pre><code>In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66,
                   from /usr/include/c++/4.4/bits/char_traits.h:41,
                   from /usr/include/c++/4.4/ios:41,
                   from /usr/include/c++/4.4/istream:40,
                   from /usr/include/c++/4.4/fstream:40,
                   from db.h:1,
                   from main.cpp:1:
  /usr/include/c++/4.4/bits/stl_pair.h: In constructor ‘std::pair&lt;_T1, _T2&gt;::pair(std::pair&lt;_U1, _U2&gt;&amp;&amp;) [with _U1 = char*, _U2 = Database::CountryRCID, _T1 = const char* const, _T2 = std::set&lt;Database::CountryRCID, Database::comp, std::allocator&lt;Database::CountryRCID&gt; &gt;]’:
  db.h:50:   instantiated from here
  /usr/include/c++/4.4/bits/stl_pair.h:107: error: no matching function for call to ‘std::set&lt;Database::CountryRCID, Database::comp, std::allocator&lt;Database::CountryRCID&gt; &gt;::set(Database::CountryRCID)’
  /usr/include/c++/4.4/bits/stl_set.h:212: note: candidates are: std::set&lt;_Key, _Compare, _Alloc&gt;::set(std::initializer_list&lt;_CharT&gt;, const _Compare&amp;, const _Alloc&amp;) [with _Key = Database::CountryRCID, _Compare = Database::comp, _Alloc = std::allocator&lt;Database::CountryRCID&gt;]
  /usr/include/c++/4.4/bits/stl_set.h:199: note:                 std::set&lt;_Key, _Compare, _Alloc&gt;::set(std::set&lt;_Key, _Compare, _Alloc&gt;&amp;&amp;) [with _Key = Database::CountryRCID, _Compare = Database::comp, _Alloc = std::allocator&lt;Database::CountryRCID&gt;]
  /usr/include/c++/4.4/bits/stl_set.h:188: note:                 std::set&lt;_Key, _Compare, _Alloc&gt;::set(const std::set&lt;_Key, _Compare, _Alloc&gt;&amp;) [with _Key = Database::CountryRCID, _Compare = Database::comp, _Alloc = std::allocator&lt;Database::CountryRCID&gt;]
  /usr/include/c++/4.4/bits/stl_set.h:145: note:                 std::set&lt;_Key, _Compare, _Alloc&gt;::set(const _Compare&amp;, const _Alloc&amp;) [with _Key = Database::CountryRCID, _Compare = Database::comp, _Alloc = std::allocator&lt;Database::CountryRCID&gt;]
  /usr/include/c++/4.4/bits/stl_set.h:136: note:                 std::set&lt;_Key, _Compare, _Alloc&gt;::set() [with _Key = Database::CountryRCID, _Compare = Database::comp, _Alloc = std::allocator&lt;Database::CountryRCID&gt;]
  </code></pre>
  
  <p>I have also tried different insert methods:</p>
  
  <pre><code>CNTVotes[CNT] = RCIDVote;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>std::pair &lt;const char*, CountryRCID&gt; test (CNT, RCIDVote);
  CNTVotes.insert(test);
  </code></pre>
  
  <p>which just results in similar errors</p>
  
  <p>I would very much appreciate it if anyone could help me understand why it is not working and what I could do to make this work.</p>
  
  <p>Thank you.</p>