Re: [C++-sig] Exposing members of members

2009-01-20 Thread David Abrahams
on Tue Jan 20 2009, Ricardo Abreu wrote: > Thank you very much for your answer, but what I really wanted was to expose > to Python > just the first element of the pair and not the whole pair, so that the fact > that it is > a pair in c++ would be transparent to python. Looks like you want to

Re: [C++-sig] Exposing members of members

2009-01-20 Thread Ralf W. Grosse-Kunstleve
> Thank you very much for your answer, but what I really wanted was to> expose > to Python just the first element of the pair and not the whole> pair, so that > the fact that it is a pair in c++ would be transparent> to python. For > instance, if I had struct A{std::pair a;};, > I just wanted to

Re: [C++-sig] Exposing members of members

2009-01-20 Thread Ricardo Abreu
Hello, Thank you very much for your answer, but what I really wanted was to expose to Python just the first element of the pair and not the whole pair, so that the fact that it is a pair in c++ would be transparent to python. For instance, if I had struct A{std::pair a;};, I just wanted to ex

Re: [C++-sig] Exposing members of members

2009-01-19 Thread Ralf W. Grosse-Kunstleve
I'd define to/from Python conversions for the std::pair, mapping to Python tuples, then use .add_property(). Alternatively, wrap std::pair the normal way via class_, then you can use .def_readwrite(). You need to handle each std::pair combination of A,B separately, like any other template class y