Boost logo

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 -o cc_from_edge_list.o In function `void init_module_cc_from_edge_list()': 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,
   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 error: parse error before `,' token 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

After I replaced "optional" with "boost::python::optional", everything
turned fine.


Boost list run by bdawes at, gregod at, cpdaniel at, john at