Boost C++ Libraries: Ticket #11970: Use perfect forwarding for object_pool https://svn.boost.org/trac10/ticket/11970 <p> boost::object_pool::construct uses a code generation system to create versions of that method that take up to some arbitrary number of input parameters. With C++11/14 it is possible to do the same using perfect forwarding, which would allow any number of input parameters using a single template method, and without bloating the hpp. </p> <p> I think this would also solve a related problem I am having. The object that I am trying to construct using the object_pool takes a unique_ptr as an input parameter to it's constructor (it is taking ownership of it): </p> <pre class="wiki">class Node {} class Tree { Tree(std::unique_ptr&lt;Node&gt; root, int foo, int bar) : m_root(std::move(root)) {} private: std::unique_ptr&lt;Node&gt; m_root; } void makeTrees() { boost::object_pool&lt;Tree&gt; treePool; std::unique_ptr&lt;Node&gt; node (new Node()); Tree* tree = treePool.construct (node, 1, 2); } </pre><p> In the current implementation, the compiler gives an error because object_pool::construct doesn't call std::move on root when newing the tree: </p> <pre class="wiki">/usr/local/include/boost/pool/detail/pool_construct.ipp(258): error: function "std::unique_ptr&lt;_Tp, _Dp&gt;::unique_ptr(const std::unique_ptr&lt;_Tp, _Dp&gt; &amp;) [with _Tp=Node, _Dp=std::function&lt;void (Node *)&gt;]" (declared at line 273 of "/usr/include/c++/4.8.5/bits/unique_ptr.h") cannot be referenced -- it is a deleted function try { new (ret) element_type(a0, a1, a2); } </pre><p> I think (but am not certain) that using perfect forwarding would allow this. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11970 Trac 1.4.3