title: QtConcurrent::map segmentation fault
body: <p>When I have been trying to implement "parallel for" using QtConcurrent::map:</p>
  
  <pre><code>QFuture&lt;void&gt; parForAsync(size_t n, std::function&lt;void (size_t)&gt; Op)
  {
  
      size_t nThreads =
              static_cast&lt;size_t&gt;(QThreadPool::globalInstance()-&gt;maxThreadCount());
      size_t nn = n/nThreads + 1;
  
      using Sequence = QVector&lt;std::function&lt;void()&gt;&gt;;
      Sequence vFuns;
  
      for(size_t i = 0; i &lt; n; i+=nn)
      {
          size_t firstIdx = i,
                  lastIdx = i + nn &gt; n ? n : i + nn;
  
          vFuns.push_back([=]()-&gt;void
          {
              for(size_t i = firstIdx; i &lt; lastIdx; ++i)
              {
                  Op(i);
              }
          });
      }
      return QtConcurrent::map&lt;Sequence&gt;    //&lt;-Segmentation fault!
              (vFuns, [](std::function&lt;void()&gt; f)
      {
          f();
      });
  }
  </code></pre>
  
  <p>I've got segmentation fault in this place:</p>
  
  <pre><code>template&lt;typename _Res, typename... _ArgTypes&gt;
      function&lt;_Res(_ArgTypes...)&gt;::
      function(const function&amp; __x)
      : _Function_base()
      {
        if (static_cast&lt;bool&gt;(__x))
      {
        __x._M_manager(_M_functor, __x._M_functor, __clone_functor); //&lt;-Segmentation fault!
        _M_invoker = __x._M_invoker;
        _M_manager = __x._M_manager;
      }
      }
  </code></pre>
  
  <p>Why is this happening? It seems that std::function had passed checking. How can I make this code working?</p>
  
  <p>Thanks in advance!</p>