title: Reducing the number of heap allocations when enqueuing tasks
body: <p>Heap allocations are a bottleneck in my application and I would like to avoid them when sending small tasks to my thread pool.</p>
  
  <p>Can I use a <code>std::packaged_task</code> with a stack allocator? Under which conditions? What are the pros/cons of this choice? Are there better alternatives to avoid heap allocations of <code>std::future</code>'s shared state by operator <code>new</code> ? </p>
  
  <pre><code>auto foo() {
    arena&lt;1024&gt; buffer;
    auto task = std::packaged_task&lt;int()&gt;{
      std::allocator_arg_t, 
      arena_allocator{arena},
      []() -&gt; int { return 5; } 
    };
    auto f = task.get_future();  // is this future and its shared state stack allocated?
    thread_pool.push_back(std::move(task)); 
    // I will probably need to block before the stack goes out of scope..
    return f.get();
  }
  </code></pre>