[C++-sig] Raw constructor (i.e. combination of make_constructor and raw_function)
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Fri Aug 26 00:27:52 CEST 2005
--- Hans Meine <meine at kogs1.informatik.uni-hamburg.de> wrote:
> Can you make a guess on the vector_wrapper performance in that respect?
> (I can live with a *small* slowdown on __getitem__ which is evened out
> elsewhere by much faster C++ algorithms like length() of a polygon.)
I never did careful timings; in fact, no timings at all.
My simple vector_wrapper doesn't do anything special. There isn't much
opportunity for a slow-down. I don't think the positive_getitem_index() call
adds much to the runtime.
> Thanks again for your scitbx-links, I will try them out for my next
> vector-like class.
I thought of the scitbx vector_wrapper just as an example you could use as a
start. It does things you don't want (the af::ref wrappers). I'd just look for
ideas and possibly copy fragments.
> Concerning my Pixel class, I will probably add some
> __init__s of varying arity (up to e.g. 5) by hand.
Sounds like a pragmatic solution.
You could also wrap the pixel class as, say, "_pixel" and add a function with
the name "pixel" using boost::python::raw_function.
Cheers,
Ralf
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Cplusplus-sig
mailing list