title: How to use NSString as key in Objective-C++ std::map
body: <p>I'm starting work on an Objective-C++ project, getting a feel for how the synthesis of the two languages feels before I do any heavy-duty design.  I am very intrigued by how Automated Reference Counting has been integrated with C++:  we get the equivalent of smart pointers for <code>NSObjects</code> that handle retain/release properly in STL containers (cf. David Chisnall's article at <a href="http://www.informit.com/articles/article.aspx?p=1745876&amp;seqNum=3" rel="noreferrer">http://www.informit.com/articles/article.aspx?p=1745876&amp;seqNum=3</a>).</p>
  
  <p>I want to use STL map as a typesafe mapping from <code>NSStrings</code> to C++ values.  I can declare a mapping as</p>
  
  <pre><code>std::map&lt;NSString*, MyType&gt; mapping
  </code></pre>
  
  <p>With ARC, this mapping handles the memory management properly.  But it doesn't follow <code>NSString</code> value semantics properly, because it's using pointer comparisons instead of <code>-[NSString compare:]</code>.  </p>
  
  <p>What's the best way to get an STL map to use string comparison instead of pointer comparison?<br>
  Should I try to specialize <code>std::less&lt;NSString*&gt;</code>?<br>
  Should I declare an explicit comparator like <code>std::map&lt;NSString*, MyType, MyCompare&gt;</code>?<br>
  Should I wrap the <code>NSString*</code> keys in a smart pointer that implements <code>operator&lt;</code>?  </p>