title: How to pass a structure to a STL map?
body: <pre><code>typedef struct
  {
      pthread_t threadId;
      int       acceptSocketD;
      char      *message;
  } threadData;
  
  map &lt;unsigned int, threadData&gt; serverPortNumberThreadId;
  map &lt;unsigned int, threadData&gt; :: iterator serverPortNumberThreadIdIter;
  </code></pre>
  
  <p>usage:</p>
  
  <pre><code>threadData obj; 
  obj.threadId      = 0;
  obj.acceptSocketD = 0;
  obj.message       = "Excuse Me, please!";
  
  serverPortNumberThreadId.insert (3490, obj);
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>error: no matching function for call to ‘std::map&lt;unsigned int, threadData&gt;::insert(int, threadData&amp;)’
  /usr/include/c++/4.5/bits/stl_map.h:500:7: note: candidates are: std::pair&lt;typename std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::_Rep_type::iterator, bool&gt; std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::insert(const std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::value_type&amp;) [with _Key = unsigned int, _Tp = threadData, _Compare = std::less&lt;unsigned int&gt;, _Alloc = std::allocator&lt;std::pair&lt;const unsigned int, threadData&gt; &gt;, typename std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::_Rep_type::iterator = std::_Rb_tree_iterator&lt;std::pair&lt;const unsigned int, threadData&gt; &gt;, std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::value_type = std::pair&lt;const unsigned int, threadData&gt;]
  /usr/include/c++/4.5/bits/stl_map.h:540:7: note:                 std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::iterator std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::insert(std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::iterator, const std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::value_type&amp;) [with _Key = unsigned int, _Tp = threadData, _Compare = std::less&lt;unsigned int&gt;, _Alloc = std::allocator&lt;std::pair&lt;const unsigned int, threadData&gt; &gt;, std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::iterator = std::_Rb_tree_iterator&lt;std::pair&lt;const unsigned int, threadData&gt; &gt;, std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::value_type = std::pair&lt;const unsigned int, threadData&gt;]
  tcpClient.cpp: In function ‘int main(int, char**)’
  </code></pre>