On Wed, Jul 22, 2009 at 11:00 PM, Matthew Scouten
(TT) wrote:
> I am looking into whether this will satisfy my needs. It looks good so
> far but I have a question:
> How am I supposed to use container_proxy? The only thing given for an
> example is a link to an empty file. Using it as a drop-in rep
I am looking into whether this will satisfy my needs. It looks good so
far but I have a question:
How am I supposed to use container_proxy? The only thing given for an
example is a link to an empty file. Using it as a drop-in replacement
for container_suite does not work.
-Original Message--
Thanks for the answer!
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
You may need to create a getter and a setter in your wrapper, and then you can
use the "make_function" function to change the CallPolicy when you use create a
property. I think you want your call policy to be return_internal_reference<>
and that will handle the lifetime correctly. Here is a re
Try something like this:
float get_a(const Foo& self) {return self.a}
void set_a(Foo& self, float a_new) {self.a = a_new }
class_("Foo", init<>())
.def_property("a", &get_a, &set_a)
;
-Original Message-
From:
cplusplus-sig-bounces+matthew.scouten=tradingtechnologies@python
I would think that .def_readwrite would do what you need. If it doesn't
look at using .def_property and get/set pair. Caveat: making sure that
'a' stays a valid reference is your problem. Python will happily crash
horribly (if you are lucky) in response to bogus pointers or references.
Thanks for
I would think that .def_readwrite would do what you need. If it doesn't
look at using .def_property and get/set pair. Caveat: making sure that
'a' stays a valid reference is your problem. Python will happily crash
horribly (if you are lucky) in response to bogus pointers or references.
-Origi
Hi all,
I'm a beginner of c++ and boost::python, so this may be a stupid
question. When I have the following class:
class Foo{
public:
float &a;
};
Is there some way to expose "a" in python? I would like to use it like a
normal python attribute, e.g. set it's value with "Foo().a = 3