title: C++ STL map , std::pair as the key
body: <p>This is how I have defined by map.</p>
  
  <pre><code>std::map&lt;std::pair&lt;std::string,std::string&gt;, int&gt;  edMap;
  </code></pre>
  
  <p>I am confuse on how to insert values , I am getting compilation error always.
  This is how I am trying to insert.</p>
  
  <pre><code>    std::pair&lt;std::string,std::string&gt; key;
      edMap.insert(key,d);
  </code></pre>
  
  <p>Compilation error is</p>
  
  <pre><code>1&gt;------ Build started: Project: spellsuggest, Configuration: Debug Win32 ------
  1&gt;Compiling...
  1&gt;breathalyzer.cpp
  1&gt;d:\personal\spellsuggest\spellsuggest\breathalyzer.cpp(70) : error C2664: 'std::_Tree&lt;_Traits&gt;::iterator std::_Tree&lt;_Traits&gt;::insert(std::_Tree&lt;_Traits&gt;::iterator,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : cannot convert parameter 1 from 'std::pair&lt;_Ty1,_Ty2&gt;' to 'std::_Tree&lt;_Traits&gt;::iterator'
  1&gt;        with
  1&gt;        [
  1&gt;            _Traits=std::_Tmap_traits&lt;std::pair&lt;std::string,std::string&gt;,int,std::less&lt;std::pair&lt;std::string,std::string&gt;&gt;,std::allocator&lt;std::pair&lt;const std::pair&lt;std::string,std::string&gt;,int&gt;&gt;,false&gt;,
  1&gt;            _Ty1=const std::pair&lt;std::string,std::string&gt;,
  1&gt;            _Ty2=int
  1&gt;        ]
  1&gt;        and
  1&gt;        [
  1&gt;            _Ty1=std::string,
  1&gt;            _Ty2=std::string
  1&gt;        ]
  1&gt;        and
  1&gt;        [
  1&gt;            _Traits=std::_Tmap_traits&lt;std::pair&lt;std::string,std::string&gt;,int,std::less&lt;std::pair&lt;std::string,std::string&gt;&gt;,std::allocator&lt;std::pair&lt;const std::pair&lt;std::string,std::string&gt;,int&gt;&gt;,false&gt;
  1&gt;        ]
  1&gt;        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
  1&gt;Build log was saved at "file://d:\personal\spellsuggest\spellsuggest\Debug\BuildLog.htm"
  1&gt;spellsuggest - 1 error(s), 0 warning(s)
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>