[C++-sig] [boost.python] char arrays in structs

David Abrahams dave at boost-consulting.com
Mon Jul 4 23:02:28 CEST 2005


"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> writes:

>> You mean thin wrapper as follows?
>> 
>> struct wrap_foo : public foo
>> {
>>    char const *get_bar() { return bar; }
>> };
>> 
>> and then
>> 
>> class_<foo_derived>("foo")
>>    .def_property("bar", &foo_derived::get_bar)
>>    ;
>
> You don't have to use inheritance just to provide a wrapper. 

In fact, it won't work in this case.  You can't call a wrap_foo member
function on a foo object.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list