title: Fill std::map with std::generate_n
body: <p>I'd like to fill a <code>std::map</code> using <code>std::generate_n</code> but can't get it to work. What I tried is something along these lines:</p>
  
  <pre><code>unsigned number_of_pairs{5};
  std::map&lt;std::string, std::string&gt; my_map;
  auto read_pair_from_input = [](){
      std::string key;
      std::getline(std::cin, key);
      std::string value;
      std::getline(std::cin, value);
      return std::make_pair(key, value);
  };
  std::generate_n(my_map.begin(), number_of_pairs, read_pair_from_input);
  </code></pre>
  
  <p>This gives me long errors like:</p>
  
  <pre><code>In file included from /opt/wandbox/gcc-    head/include/c++/8.0.0/algorithm:62:0,
                   from prog.cc:1:
  /opt/wandbox/gcc-head/include/c++/8.0.0/bits/stl_algo.h: In instantiation of     '_OIter std::generate_n(_OIter, _Size, _Generator) [with _OIter =     std::_Rb_tree_iterator&lt;std::pair&lt;const std::__cxx11::basic_string&lt;char&gt;,     std::__cxx11::basic_string&lt;char&gt; &gt; &gt;; _Size = unsigned int; _Generator =     main()::&lt;lambda()&gt;]':
  prog.cc:18:74:   required from here
  /opt/wandbox/gcc-head/include/c++/8.0.0/bits/stl_algo.h:4468:11: error: use     of deleted function 'std::pair&lt;_T1, _T2&gt;&amp; std::pair&lt;_T1, _T2&gt;::operator=    (typename std::conditional&lt;std::__not_&lt;std::__and_&lt;std::is_copy_assignable&lt;_Tp&gt;,     std::is_copy_assignable&lt;_T2&gt; &gt; &gt;::value, const std::pair&lt;_T1, _T2&gt;&amp;, const     std::__nonesuch_no_braces&amp;&gt;::type) [with _T1 = const     std::__cxx11::basic_string&lt;char&gt;; _T2 = std::__cxx11::basic_string&lt;char&gt;;     typename std::conditional&lt;std::__not_&lt;std::__and_&lt;std::is_copy_assignable&lt;_Tp&gt;,     std::is_copy_assignable&lt;_T2&gt; &gt; &gt;::value, const std::pair&lt;_T1, _T2&gt;&amp;, const     std::__nonesuch_no_braces&amp;&gt;::type = const std::pair&lt;const     std::__cxx11::basic_string&lt;char&gt;, std::__cxx11::basic_string&lt;char&gt; &gt;&amp;]'
    *__first = __gen();
    ~~~~~~~~~^~~~~~~~~
  In file included from /opt/wandbox/gcc-head/include/c++/8.0.0/utility:70:0,
                   from /opt/wandbox/gcc-head/include/c++/8.0.0/algorithm:60,
                   from prog.cc:1:
  /opt/wandbox/gcc-head/include/c++/8.0.0/bits/stl_pair.h:378:7: note:     declared here
         operator=(typename conditional&lt;
         ^~~~~~~~
  </code></pre>
  
  <p>Is it possible to fill a <code>std::map</code> with <code>std::generate_n</code>?</p>