[C++-sig] A couple of simple BP V2 questions
Joel de Guzman
djowel at gmx.co.uk
Wed Nov 13 20:11:01 CET 2002
----- Original Message -----
From: "Scott A. Smith" <ssmith at magnet.fsu.edu>
> 3.) BP function exports
> .def("foo", (object(X::*)(std::string, bool) const)0,
> .def("foo", (object(X::*)(int, bool) const)0,
> .def("foo", (object(X::*)(list, list, bool) const)0,
> which helps out a lot in clarifying things. Use of .def here deviates quite
> bit from that shown in the tutorial (anywhere), but I guess you can't show
> What is the 0 following const) in the above three lines for? I cannot find
> this even
> in the reference manual.
The 0? It's an easter egg :-)
No..., seriously, it's casting a null (0) pointer. This is safe
because the pointer is actually never used but is needed
only to pass on the type information.
Dave, is this idiom common? Maybe we can add a chapter
on common boost python idioms in the tutorial. Many
programmers (including me) rely on common, tried and true,
idioms. Then again, we need to compile a list of these idioms.
More information about the Cplusplus-sig