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

2012-01-31 Thread Jim Bosch
On 01/31/2012 02:52 PM, Michael Wild wrote: You might be able to address that by having two make_helper functions, using enable_if/disable_if to select one when the return type is const and the other when it isn't. The one invoked for const returns would just call make_function directly to make

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. If possible, I'd like to avoid them because I don

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

2012-01-31 Thread Jim Bosch
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. If possible, I'd like to avoid them because I don't fancy writing hundreds of those... I could live with

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 could live with calling a template. However, so far I

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

2012-01-30 Thread Jim Bosch
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 could live with calling a template. However, so far I haven't been able to come up with one that is suf

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() { return m_s; } > > The second argument to add_property sho

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

2012-01-30 Thread Jim Bosch
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() { return m_s; } The second argument to add_property should be an actual setter, not a non-const-reference getter. In

[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