Re: [C++-sig] CallPolicy for operators

2013-03-15 Thread Michael Wild
On Fri, Mar 15, 2013 at 12:54 PM, Neal Becker wrote: > Jim Bosch wrote: > > > On 01/27/2013 05:02 AM, Michael Wild wrote: > >> Hi all > >> > >> Is there a way to apply a CallPolicy to operator definitions? In > >> particular, I'm in

[C++-sig] CallPolicy for operators

2013-01-27 Thread Michael Wild
Hi all Is there a way to apply a CallPolicy to operator definitions? In particular, I'm interested in the inplace operators (+=, -=, *=, /= and friends). To give a bit more context: The library I'm trying to wrap exposes some static const objects. So far, I have been able to wrap modifying functi

Re: [C++-sig] to_python converter and make_getter

2013-01-24 Thread Michael Wild
[re-post with the correct from-address, the original got rejected] On 01/23/2013 07:08 PM, Michael Wild wrote: > On 01/23/2013 07:03 PM, Jim Bosch wrote: >> On 01/23/2013 12:56 PM, Michael Wild wrote: >> >> >> >>> >>> Yes, I thought of that too. While

Re: [C++-sig] to_python converter and make_getter

2013-01-23 Thread Michael Wild
On 01/23/2013 07:03 PM, Jim Bosch wrote: > On 01/23/2013 12:56 PM, Michael Wild wrote: > > > >> >> Yes, I thought of that too. While this "solves" this case (it certainly >> is not very discoverable for future maintainers), it does not help in >>

Re: [C++-sig] to_python converter and make_getter

2013-01-23 Thread Michael Wild
On 01/23/2013 05:44 PM, Jim Bosch wrote: > On 01/23/2013 12:34 AM, Michael Wild wrote: >> On 01/22/2013 11:27 PM, Jim Bosch wrote: >>> On 01/22/2013 04:18 PM, Michael Wild wrote: >>>> Dear all >>>> >>>> I have defined a to_python converter f

Re: [C++-sig] Failed to import pyd File When python embed into C++

2013-01-23 Thread Michael Wild
On Wed, Jan 23, 2013 at 8:19 AM, salinea wrote: > > I create a pyd File named "testPyd" with boostPython,and then I import the > testPyd module into "test.py", it works perfect! > But when I embeded the python interpreter into my C++ project and run the > "test.py", it comes out a "ImportErr: no

Re: [C++-sig] to_python converter and make_getter

2013-01-22 Thread Michael Wild
On 01/22/2013 11:27 PM, Jim Bosch wrote: > On 01/22/2013 04:18 PM, Michael Wild wrote: >> Dear all >> >> I have defined a to_python converter following >> http://misspent.wordpress.com/2009/09/27/how-to-write-boost-python-converters. >> >> Everything is

[C++-sig] to_python converter and make_getter

2013-01-22 Thread Michael Wild
Dear all I have defined a to_python converter following http://misspent.wordpress.com/2009/09/27/how-to-write-boost-python-converters. Everything is fine and dandy, however what bugs me is having to specify a return_value_policy() for every make_getter call. Looking through the sources it seems th

Re: [C++-sig] Wrapping a non-copyiable static instance in bp::object

2013-01-20 Thread Michael Wild
.attr("static_a") = boost::ref(A::static_a); //no copy here > > regards > > > 2013/1/16 Michael Wild : >> Dear all >> >> I struggle to find a way in which I can wrap a static instance in a >> bp::object without copying it. The goal is to have

[C++-sig] Wrapping a non-copyiable static instance in bp::object

2013-01-16 Thread Michael Wild
Dear all I struggle to find a way in which I can wrap a static instance in a bp::object without copying it. The goal is to have object identity for this static instance: struct A { /*...*/ static A static_a; }; a A::a; bp::object static_instance() { static bp::object* result = new bp::obj

Re: [C++-sig] Boost.Python property definition question

2012-01-31 Thread Michael Wild
On 01/31/2012 05:56 PM, Jim Bosch wrote: > On 01/31/2012 12:41 AM, Michael Wild wrote: >> On 01/30/2012 07:28 PM, Jim Bosch wrote: >>> On 01/30/2012 12:11 PM, Michael Wild wrote: >>>> That's what I've been referring to as "auxiliary" functions.

Re: [C++-sig] Boost.Python property definition question

2012-01-30 Thread Michael Wild
On 01/30/2012 07:28 PM, Jim Bosch wrote: > On 01/30/2012 12:11 PM, Michael Wild wrote: >> That's what I've been referring to as "auxiliary" functions. If >> possible, I'd like to avoid them because I don't fancy writing hundreds >> of those... I

Re: [C++-sig] Boost.Python property definition question

2012-01-30 Thread Michael Wild
On 01/30/2012 04:58 PM, Jim Bosch wrote: > On 01/30/2012 09:32 AM, Michael Wild wrote: >> Hi all >> >> I can't seem to figure out how to wrap this in Boost.Python without the >> need for auxiliary functions: >> > > > >>string& s()

[C++-sig] Boost.Python property definition question

2012-01-30 Thread Michael Wild
Hi all I can't seem to figure out how to wrap this in Boost.Python without the need for auxiliary functions: #include #include using std::string; using namespace boost::python; class A { string m_s; public: A(string const& s) : m_s(s) {} // read-only access ( string const& s() const

[C++-sig] Docstrings question

2010-10-15 Thread Michael Wild
Hi all I'm fairly new to Boost.Python and currently I'm looking for a convenient way of adding docstrings to overloaded operators, e.g: class A; class B A operator+(A const&, A const&); B operator+(B const&, B const&); BOOST_PYTHON_MODULE(foo) { bp::class_("A") .def(self + self) //< How to a