Hi Jeremy,

I think you have a fundamental misunderstanding of the Boost.Python API,
so I suggest you step back a little to first get a better sense of how
the mapping between the two languages works:

On 18/08/15 04:38 AM, Jeremy Murphy wrote:
>
> struct Point : public boost::python::object {}
> struct LinearRing : public boost::python::object {}

There is really no point in deriving your own types from
boost::python::object. Instead, you should take your own (existing !)
types and embedd them into Python objects using a mechanism described in
detail in the Boost.Python tutorial:
http://boostorg.github.io/python/doc/html/tutorial/tutorial/exposing.html


>
> which I can then adapt by specializing the required traits class
> templates. My algorithm in C++ looks something like:
>
> void native_algorithm(boost::geometry::model::point const &x) {...}
>
> void python_algorithm(boost::python::object const &x)
> {
>     native_algorithm(static_cast<Point const&>(x));
> }

(I'm not entirely understand what you are trying here. Notably, what's
the relationship between the type 'Point' (which you have defined above)
and boost::geometry::model::python ?)

I suggest you start by carefully reading the tutorial referenced above,
to see how C++ objects can be embedded into (and extracted from) Python
objects.
That may not yet answer all your questions, but I'm convinced that once
you understand the techniques described there, you will ask
fundamentally different questions, which I'll gladly try to answer. :-)

Regards,
        Stefan



-- 

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to