title: Why do I get an error in "forming reference to reference type" map?
body: <p>What is the alternative if I need to use a reference, and the data I am passing I cannot change the type of, hence I cannot really store a pointer to it?</p>
  
  <h3>Code:</h3>
  
  <pre><code>    #include &lt;map&gt;     
      #include&lt;iostream&gt;
      #include&lt;string&gt;     
  
      using namespace std;
  
      int main()
      {
         string test;
         pair&lt;string, string&gt; p=pair&lt;string, string&gt;("Foo","Bar");
         map&lt;pair&lt;string, string&gt;, string&amp;&gt; m;
         m[make_pair("aa","bb")]=test;
  
         return 0;
  }
  </code></pre>
  
  <h3>Error:</h3>
  
  <blockquote>
    <p>$ g++ MapPair.cpp
    /usr/include/c++/3.2.3/bits/stl_map.h:
    In instantiation of
    <code>std::map&lt;std::pair&lt;std::string,
    std::string&gt;, std::string&amp;,
    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;,
    std::string&amp;&gt; &gt; &gt;': MapPair.cpp:15:<br>
    instantiated from here
    /usr/include/c++/3.2.3/bits/stl_map.h:221:
    forming reference to reference type
    </code>std::string&amp;' MapPair.cpp: In
    function <code>int main()': MapPair.cpp:16:
    no match for
    </code>std::map,     std::string&amp;,
    std::less >,<br>
    std::allocator,<br>
    std::string&amp;> > >&amp; [std::pair]' operator
    /usr/include/c++/3.2.3/bits/stl_pair.h:
    At global scope:
    /usr/include/c++/3.2.3/bits/stl_pair.h:
    In instantiation of <code>std::pair&lt;const
    std::pair&lt;std::string, std::string&gt;,
    std::string&amp;&gt;':
    /usr/include/c++/3.2.3/bits/stl_tree.h:122:
    instantiated from
    </code>std::_Rb_tree_node
  </blockquote>
  
  <p>What am I doing wrong to cause this errror?</p>