Boost logo

Boost :

From: Pearu Peterson (boost_at_[hidden])
Date: 2001-04-06 02:31:46


Hi!

Question:
Is is it possible to define special methods other than specified in
the table of Automatically Wrapped Methods?

I really miss methods like __contains__, __lt__, __gt__, __le__, __eq__,
__ne__, __ge__. And defining them, for example, as

  lst_class.def(&basic_w::has_w, "__contains__");

has wrong effect in Python:

>>> l=lst(1,2,3)
>>> l
lst([ex(1), ex(2), ex(3)])
>>> 2 in l
0 # should be 1!!!
>>> l.__contains__ (2)
1

Regards,
        Pearu


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk