[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-cpp-sig
Subject:    Re: [C++-sig] undefined symbols with def_readonly
From:       Andreas =?iso-8859-1?q?Kl=F6ckner?= <lists () informa ! tiker ! net>
Date:       2008-04-11 14:26:51
Message-ID: 200804111026.52892.lists () informa ! tiker ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Freitag 11 April 2008, Stefan Seefeld wrote:
> > But what's _really_ weird, is:
> >     .add_static_property ("TAIL_BITS", turbo_enc_1_15::TAIL_BITS)
> >
> > gives:
> > TypeError: 'int' object is not callable
>
> That suggests that, even though the add_static_property function
> template is generic (read: unconstrained) in its second parameter
> (leading to the construction of a python 'int' object holding
> TAIL_BITS), such an object is not callable (as static properties should
> be). In other words, users are expected to pass function (pointers) or
> similar there, and the implementation of add_static_property just fails
> to enforce that.

Yeah, that was kinda the whole point--you introduce a small static getter 
function to return the value of the static data member.

That getter does not need to take the address of the member, and therefore you 
don't need to have memory allocated for it. Having the extra 
function "litter" around is not pretty, but it was acceptable to me. The 
address of the *getter* is what you pass to add_static_property(). Sorry for 
not being sufficiently clear.

Andreas

["signature.asc" (application/pgp-signature)]

_______________________________________________
C++-sig mailing list
C++-sig@python.org
http://mail.python.org/mailman/listinfo/c++-sig


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic