Re: [C++-sig] Exposing Friend Functions in C++ Python Boost

2014-07-21 Thread Kv Gopalkrishnan
Hi Michael Yes this works. Thank you for your answer and help :) Kind Regards KV On Fri, Jul 18, 2014 at 3:41 PM, Michael Rybakov wrote: > When I said “outside” I meant standalone function. > Moreover I see you’ve added property with the same functions. This won’t > work. I woul

Re: [C++-sig] Exposing Friend Functions in C++ Python Boost

2014-07-18 Thread Michael Rybakov
When I said “outside” I meant standalone function. Moreover I see you’ve added property with the same functions. This won’t work. I would recommend you to look at docs -http://www.boost.org/doc/libs/1_55_0/libs/python/doc/tutorial/doc/html/python/exposing.html#python.constructors Valid wrap with

Re: [C++-sig] Exposing Friend Functions in C++ Python Boost

2014-07-18 Thread Kv Gopalkrishnan
Hi Thanks Michael For the answer however I am a bit confused about the solution you gave. Do you mean to remove the GetHeading function and paste it outside class Turtle ? Jim here is a concrete example. #include #include #include #include using namespace std; using namespace cxxadt;

Re: [C++-sig] Exposing Friend Functions in C++ Python Boost

2014-07-18 Thread Jim Bosch
On Jul 18, 2014 6:32 AM, "Kv Gopalkrishnan" wrote: > > Hi Jim > Thank you for the answer. When I tried this solution > i.e. .def("GetHeading",&GetHeading) > error: ‘GetHeading’ was not declared in this scope > > > I get the above error. > Stating the obvious the error says function was

Re: [C++-sig] Exposing Friend Functions in C++ Python Boost

2014-07-18 Thread Michael Rybakov
In C++ friend functions does not become methods. They just take params of that type. Move your friend function’s from class declaration and you will be fine. On 16 Jul 2014, at 15:52, Kv Gopalkrishnan wrote: > I want to expose a C++ friend functions to python using Python boost. > class Turtl

Re: [C++-sig] Exposing Friend Functions in C++ Python Boost

2014-07-18 Thread Kv Gopalkrishnan
Hi Jim Thank you for the answer. When I tried this solution i.e. .def("GetHeading",&GetHeading) error: ‘GetHeading’ was not declared in this scope I get the above error. Stating the obvious the error says function was not described in the scope. Seems a bit nasty business is it so tha

Re: [C++-sig] Exposing Friend Functions in C++ Python Boost

2014-07-17 Thread Jim Bosch
The problem here is actually a C++ issue, not a Boost.Python one. Friend functions aren't considered to be part of the scope of the class that they're friends with, so when referring to them, just use e.g. "&GetHeading", not "&Turtle::GetHeading". Jim On Wed, Jul 16, 2014 at 7:52 AM, Kv Gopalk

[C++-sig] Exposing Friend Functions in C++ Python Boost

2014-07-17 Thread Kv Gopalkrishnan
I want to expose a C++ friend functions to python using Python boost. class Turtle{ friend const PV& GetHeading(const Turtle& t); friend const PV& GetLeft(const Turtle& t); friend const P& GetPoint(const Turtle& t); frien