title: C++ algorithm find_if in map
body: <p>I want to find pair in map and just print it.
  This is my code:</p>
  <pre><code>    std::map&lt;std::string, std::string&gt; mLoginPasswordMap{ &quot;test&quot;, &quot;test2&quot; };
      std::string key1(&quot;test&quot;);
      std::string value1(&quot;test2&quot;);
      auto it = std::find_if( mLoginPasswordMap.cbegin(),
                          mLoginPasswordMap.cend(),
                          [&amp;key1, &amp;value1]( const auto&amp; elem )
                          {
                              return ( key1 == elem.first &amp;&amp; value1 == elem.second );
                          });
  
      if( it != mLoginPasswordMap.cend() )
      {
          std::cout &lt;&lt; it-&gt;first &lt;&lt; endl;
          std::cout &lt;&lt; it-&gt;second &lt;&lt; endl;
      }
      if( it == mLoginPasswordMap.cend() )
      {
          std::cout &lt;&lt; &quot;No pair in map&quot; &lt;&lt; endl;
      }
  </code></pre>
  <p>and I receive this kind of error when program is compiling:</p>
  <pre><code>usr/include/c++/9/bits/stl_map.h:273:4:   required from ‘std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::map(_InputIterator, _InputIterator) [with _InputIterator = const char*; _Key = std::__cxx11::basic_string&lt;char&gt;; _Tp = std::__cxx11::basic_string&lt;char&gt;; _Compare = std::less&lt;std::__cxx11::basic_string&lt;char&gt; &gt;; _Alloc = std::allocator&lt;std::pair&lt;const std::__cxx11::basic_string&lt;char&gt;, std::__cxx11::basic_string&lt;char&gt; &gt; &gt;]’
  main.cpp:23:79:   required from here
  /usr/include/c++/9/ext/new_allocator.h:146:4: error: no matching function for call to ‘std::pair&lt;const std::__cxx11::basic_string&lt;char&gt;, std::__cxx11::basic_string&lt;char&gt; &gt;::pair(const char&amp;)’
    146 |  { ::new((void *)__p) _Up(std::forward&lt;_Args&gt;(__args)...); }
        |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  </code></pre>
  <p>I don't know what I'm doing wrong.
  Anyone can help me?</p>