I am trying to wrap my C++ code using Boost.Python and have encountered a couple errors and could use some help at solving them. But first here are the assets I have.
Product.h
namespace Products
{
class Product
{
public:
virtual ~Product() {};
virtual int generateProduct(int verbose = 0) = 0;
virtual int getQueueNum() = 0;
virtual std::vector<std::vector<std::string> > getQueue(const int &index_int) = 0;
};
}
ProductBuilder.h
namespace Products
{
class ProductBuilder
{
public:
ProductBuilder(const std::map<std::string,std::string> input_map, const std::deque<std::string> &dates_deque);
int build(int verbose = 0);
int numQueue() {return m_product->getQueueNum();};
std::vector<std::vector<std::string> > getQueueByIndex(const int &index_int) {return m_product->getQueue(index_int);};
private:
std::unique_ptr<Products::Product> m_product;
};
}
full-wrapper.cpp
BOOST_PYTHON_MODULE(alucard)
{
class_<Products::ProductBuilder>("ProductBuilder", init<std::map<std::string,std::string>,std::deque<std::string>>())
.def("build", &Products::ProductBuilder::build)
.def("numQueue", &Products::ProductBuilder::numQueue)
.def("getQueueByIndex", &Products::ProductBuilder::getQueueByIndex)
;
}
The errors that I am getting when I build the library via cmake are as follows:
/usr/include/boost/python/object/value_holder.hpp:133:13: error: use of deleted function ‘Products::ProductBuilder::ProductBuilder(const Products::ProductBuilder&)’
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil)
^
In file included from /home/jlahowetz2/development/cpp-python-wrapper/full-wrapper.cpp:11:0:
/data/alucard/include/ProductBuilder.h:25:9: note: ‘Products::ProductBuilder::ProductBuilder(const Products::ProductBuilder&)’ is implicitly deleted because the default definition would be ill-formed:
class ProductBuilder
^~~~~~~~~~~~~~
/data/alucard/include/ProductBuilder.h:25:9: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = Products::Product; _Dp = std::default_delete<Products::Product>]’
In file included from /usr/include/c++/7/memory:80:0,
from /usr/include/boost/function/function_base.hpp:16,
from /usr/include/boost/function/detail/prologue.hpp:17,
from /usr/include/boost/function/function_template.hpp:13,
from /usr/include/boost/function/detail/maybe_include.hpp:13,
from /usr/include/boost/function/function0.hpp:11,
from /usr/include/boost/python/errors.hpp:13,
from /usr/include/boost/python/handle.hpp:11,
from /usr/include/boost/python/args_fwd.hpp:10,
from /usr/include/boost/python/args.hpp:10,
from /usr/include/boost/python.hpp:11,
from /home/jlahowetz2/development/cpp-python-wrapper/full-wrapper.cpp:1:
/usr/include/c++/7/bits/unique_ptr.h:383:7: note: declared here
unique_ptr(const unique_ptr&) = delete;
^~~~~~~~~~
from Boost.Python library build errors when no default constructor and unique pointer
No comments:
Post a Comment