TypeError: No to_python (by-value) converter found for C++ type:

382 views
Skip to first unread message

tommy

unread,
Mar 13, 2012, 7:19:33 AM3/13/12
to boost_doc_translation
-----------------Relevant C++ code-----------------

struct my_struct
{
int i_;
bool operator==(my_struct const& m) const {return i_ == m.i_;}
};

BOOST_PYTHON_MODULE(pye)
{
class_<my_struct>("my_struct")
.def_readwrite("i", &my_struct::i_)
;

class_<std::vector<my_struct *> >("my_struct_vector")
.def(vector_indexing_suite<std::vector<my_struct *> >())
;
};


-----------------Relevant Python code-----------------

from pye import *
q = my_struct()
q.i = 3

my_vec = my_struct_vector()
my_vec.append(q)

len(my_vec)
print my_vec[0].i

for item in my_vec :
print item.i
Reply all
Reply to author
Forward
0 new messages