On 16.06.2012 17:57, vikas chauhan wrote:
> Is it possible to do what I want ( i.e add separate attributes using the
> single geta()/seta() functions ) or I need to write some kind of wrapper
> functions (each for accessing each a[i]) ?
I guess the simplest way to do that is to template the geta and seta
function similar to this one:
class X {
template <int index>
int geta() throw(foo) {
return a[index];
}
// ...
}
you then somehow need to force instanciation I guess, maybe a plain
// ...
.add_property("a0", &X::geta<0>)
does the trick, but I doubt it. This just as a suggestion for a
direction to do research in, I did not try it, neither I would bet that
it works ;)
cheers,
Jonas
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig