Roman Yakovenko wrote:
> On Mon, Dec 8, 2008 at 6:42 PM, Stefan Seefeld <[EMAIL PROTECTED]> wrote:
>   
>> Hans Meine wrote:
>>     
>>> How about adding an id() method (returning this) to the C++ class and
>>> exporting that?
>>>
>>>       
>> Well, this 'id' isn't really a property of the wrapped type / object, but
>> the wrapper. So, I think there is little sense in adding such a tautological
>> 'id' function to the class itself. A free-standing
>>
>> type const *id(type const *t) { return t;}
>>
>> function would be more clean, IMO.
>>     
>
> I think he wants size_t as return type:
>
> template< class type >
> size_t id( const type* t ){ return size_t( t ); }
>
> class_< XXX >(....)
>     .def( "id", &id<XXX> );
>
>   
This is indeed what I was looking for, thanks!

Paul
> Py++ has this and other functionality to allow better experience,
> while exposing "C" libraries:
>
> http://language-binding.net/pyplusplus/documentation/ctypes/ctypes_integration.html
> http://language-binding.net/pyplusplus/documentation/ctypes/this_and_sizeof.html
>
>   

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to