title: Thread safety of std::map for read-only operations
body: <p>I have a std::map that I use to map values (field ID's) to a human readable string. This map is initialised once when my program starts before any other threads are started, and after that it is never modified again. Right now, I give every thread its own copy of this (rather large) map but this is obviously inefficient use of memory and it slows program startup. So I was thinking of giving each thread a pointer to the map, but that raises a thread-safety issue.</p>
  
  <p>If all I'm doing is reading from the map using the following code:</p>
  
  <pre><code>std::string name;
  //here N is the field id for which I want the human readable name
  unsigned field_id = N; 
  std::map&lt;unsigned,std::string&gt;::const_iterator map_it;
  
  // fields_p is a const std::map&lt;unsigned, std::string&gt;* to the map concerned.
  // multiple threads will share this.
  map_it = fields_p-&gt;find(field_id);
  if (map_it != fields_p-&gt;end())
  {
      name = map_it-&gt;second;
  }
  else
  {
      name = "";
  }
  </code></pre>
  
  <p>Will this work or are there issues with reading a std::map from multiple threads?</p>
  
  <p>Note: I'm working with visual studio 2008 currently, but I'd like this to work acros most main STL implementations. </p>
  
  <p>Update: Edited code sample for const correctness.</p>