[C++-sig] Re: Static, again...
by Mike Rovner other posts by this author
Nov 15 2002 1:43AM messages near this date
RE: [C++-sig] Static, again...
|
Re: [C++-sig] Re: Static, again...
"Hugo van der Merwe" <hugo@[...].za> wrote in message
news:20021114053940.GB16542@[...]..
> On Wed, Nov 13, 2002 at 08:19:53AM -0500, David Abrahams wrote:
> > Hugo van der Merwe <hugo@[...].za> writes:
> >
> > Yes, but I'll leave it as an "exercise for the reader". Properties are
> > a Python 2.2 thing, not a Boost.Python feature. Try it in pure
> > Python. If you can get that to work, you can probably get it to work
> > in Boost.Python. Hint: you'll need a proxy class.
If I understand correctly
Pythons
x.a[3]=1
will go through
__setitem__(__getattr__(x,"a"), 3, 1)
If so, it shall be easy (untested):
struct proxy {
GetItem();
SetItem():
};
struct X {
proxy a;
}
class_<proxy> ("proxy")
.def("__getitem__", &proxy::GetItem)
.def("__setitem__", &proxy::SetItem)
;
class_<X> ("X")
.add_property("a", &X::a)
;
Right?
_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Hugo van der Merwe
Scott A. Smith
David Abrahams
Scott A. Smith
Nicodemus
Scott A. Smith
Mike Rovner
David Abrahams
David Abrahams
Hugo van der Merwe
Hugo van der Merwe
David Abrahams
Hugo van der Merwe
David Abrahams
|