title: How to apply transform to an STL map in C++
body: <p>In C++, I'm using transform to change all the values of a map to uppercase.</p>
  
  <pre><code>  std::map&lt;std::string, std::string&gt; data = getData();
  
    // make all values uppercase
    std::transform(data.begin(), data.end(), data.begin(),
           [](std::pair&lt;std::string, std::string&gt;&amp; p) {
             boost::to_upper(p.second);
             return(p);
           });
  </code></pre>
  
  <p>This gives me the following compilation error:</p>
  
  <pre><code>/opt/local/include/gcc46/c++/bits/stl_algo.h:4805:2: error: no match for call to '(main(int, char**)::&lt;lambda(std::pair&lt;std::basic_string&lt;char&gt;, std::basic_string&lt;char&gt; &gt;&amp;)&gt;) (std::pair&lt;const std::basic_string&lt;char&gt;, std::basic_string&lt;char&gt; &gt;&amp;)
  </code></pre>
  
  <p>I think there's something wrong with the type of the argument in my lambda expression. It's probably something simple, but I can't seem to figure out what's expected.</p>