[C++-sig] Exposing members of members (original) (raw)

Ricardo Abreu gumbeto at gmail.com
Mon Jan 19 16:27:46 CET 2009


Hello,

Suppose that I have a class A with a member of type std::pair, called a. If I want to expose class A to python while allowing read/write access to the object pointed to by a.first, what to I put in def_readwrite?

I tried something like class("A").def_readwrite("a", &A::a::first); but it doesn't work. Also been trying with boost::bind but didn't have any luck :s

I know I could do getters and setters, but there would be a lot of them because my "A" has a lot of members like "a".

Thank you in advance, Ricardo



More information about the Cplusplus-sig mailing list