translating "setattr" to C++

Dan Bishop danb_83 at yahoo.com
Fri Mar 19 23:17:36 CET 2004


Eric <eric at lentil.com> wrote in message news:<87oeqtkruw.fsf at subopt.austin.rr.com>...
> Slightly off topic, i know, but here goes:
> 
> I'm trying to xlate a module of mine to C++. Only problem is, it makes
> heavy use of "setattr". Anyone know a straightforward way to do
> "setattr" in C++ ?

No, but there's a workaround.

Instead of referring to the fields of an object as, for example, x.foo
and x.bar, store your object's data in a hash table with "foo" and
"bar" as keys.



More information about the Python-list mailing list