id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 11970,Use perfect forwarding for object_pool,djpeaco@…,Chris Newbold,"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. 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): {{{ class Node {} class Tree { Tree(std::unique_ptr root, int foo, int bar) : m_root(std::move(root)) {} private: std::unique_ptr m_root; } void makeTrees() { boost::object_pool treePool; std::unique_ptr node (new Node()); Tree* tree = treePool.construct (node, 1, 2); } }}} In the current implementation, the compiler gives an error because object_pool::construct doesn't call std::move on root when newing the tree: {{{ /usr/local/include/boost/pool/detail/pool_construct.ipp(258): error: function ""std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp> &) [with _Tp=Node, _Dp=std::function]"" (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); } }}} I think (but am not certain) that using perfect forwarding would allow this.",Feature Requests,new,To Be Determined,pool,Boost 1.61.0,Problem,,object_pool,