[C++-sig] How can I wrap assign operator(=) in Boost::Python?

Roman Yakovenko roman.yakovenko at gmail.com
Wed Jan 16 08:07:57 CET 2008


On Jan 16, 2008 6:14 AM, Steve Yin <steve at chinavfx.net> wrote:
> Hi all,
>     I'm a new guy to this, I have a class, eg: Vector, by default, If I
> create a variable v1, then use v2 = v1, the result is v2 and v1 are exact
> same object, but in C++ I have a assign operator, How can I export this
> assign operator to Python?

You can only expose it as regular method. Python doesn't have "assign" operator.

...
 .def( "assign", ::your_class::operator= )


-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list