Hi Alexey, you can use this example to see how create converter rules in boost:pyhton: http://www.boost.org/doc/libs/1_39_0/libs/python/doc/v2/faq.html#custom_string
or you can expose you class to pyhon using boost:python in normal way. http://www.boost.org/doc/libs/1_39_0/libs/python/doc/tutorial/doc/html/python/exposing.html BR On Sat, Jul 4, 2009 at 8:50 PM, Alexey Akimov<alexey.akimo...@gmail.com> wrote: > Hi, > Here is a question.(see Subject title) I am particularly interested in such > implementation using python.boost library. > For simple cases I've seen examples, such as: > > int x = extract<int>(obj.attr("Attribute_name")) > > However, when a type T in extract<T>() becomes user-specified things become > harder. For example, > suppose I have a type Vector wich is something like: > > class Vector{ > public: > double x,y,z; > }; > > and want to extract information from python object obj to c++ obect of class > Vector IN ONE OPERATION. > I've found that there are some converters for some standard types, but I'm > not able to manage how to do this > for my class. What should I do in order to make the extract<> function to > understand how it should convert a python > object (represented as boost::python::object - something like this) into > Vector object? > Again, variant like: > Vector r; > r.x = extract<double>(obj.attr("x")) > ... and so on > are not interested. I need to make it in one operation. > Thanks > > Alexey > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig