|
Boost : |
From: Yu Huang (yuhuang_at_[hidden])
Date: 2005-09-06 21:06:50
Hi Dave,
I coded a class with three constructors. One has two default arguments.
So according to Boost::Python's doc, i used optional<>.
Wrapping code is like this
class_<ClusterByEBC, bases<cc_from_edge_list> >("ClusterByEBC")
.def(init<std::string, int, int, float, optional<int,
std::string> >())
.def(init<boost::python::list, int, float>())
.def("run", &ClusterByEBC::run)
.def_readonly("cc_list", &ClusterByEBC::cc_list)
.def_readonly("cc_vertex_list", &ClusterByEBC::cc_vertex_list)
;
When compiling, I got such error.
g++ -O2 -fPIC -I ~/script/hhu_clustering/include/arpack++/include/ -I
/usr/include/python2.3 -c cc_from_edge_list.cc -o cc_from_edge_list.o
cc_from_edge_list.cc: In function `void init_module_cc_from_edge_list()':
cc_from_edge_list.cc:472: error: use of `optional' is ambiguous
/usr/include/boost/python/init.hpp:62: error: first declared as `
template<class T0, class T1, class T2, class T3, class T4, class T5,
class
T6, class T7, class T8, class T9, class T10, class T11, class T12, class
T13, class T14> struct boost::python::optional' here
/usr/include/boost/optional/optional.hpp:371: error: also declared as `
template<class T> class boost::optional' here
cc_from_edge_list.cc:472: error: parse error before `,' token
cc_from_edge_list.cc:472: error: parse error before `>' token
make: *** [cc_from_edge_list.o] Error 1
Here, i found there's another "optional" which was written by Fernando
Cacciola.
After I replaced "optional" with "boost::python::optional", everything
turned fine.
Thanks,
Yu
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk