Re: [C++-sig] [python] python + phoenix

2009-10-30 Thread troy d. straszheim
Ravi wrote: On Wednesday 14 October 2009 21:59:42 troy d. straszheim wrote: def("plus", as(arg1 + arg2)); This is very cool and pretty intuitive. My main concern is that one needs to build up the function type in generic code (as opposed to mpl vectors), but we do have function_types to

Re: [C++-sig] [python] python + phoenix

2009-10-30 Thread Ravi
On Wednesday 14 October 2009 21:59:42 troy d. straszheim wrote: > boost::function still works, and doesn't require as<>: > >boost::function myplus = std::plus(); >def("myplus", myplus); > > and old-school function objects: > >def("otherplus", std::plus()) > > I was surprised to find

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-30 Thread Ravi
On Friday 23 October 2009 04:38:30 Michele De Stefano wrote: > typedef struct _p_Mat* Mat; Creating a converter to/from a raw pointer is rather tricky (due to the way argument type deduction handles pointers & references seamlessly, IIUC). You should either expose _p_Mat or wrap the ra

Re: [C++-sig] How do I wrap a static member function?

2009-10-30 Thread Ravi
Use class_.staticmethod(...) as shown below: On Friday 30 October 2009 17:47:45 James Amundson wrote: > BOOST_PYTHON_MODULE(foo) > { > class_("Foo",init<>()) > .def("doit", &Foo::doit) .staticmethod( "doit" ) > .def("nonstatic_doit", &Foo::nonstatic_doit) > ; > } Reg

[C++-sig] How do I wrap a static member function?

2009-10-30 Thread James Amundson
Hi, I have the following code: --- #include #include class Foo { public: Foo() {} ; static void doit(const char * message) { std::cout << "doing it statically: " << message << "\n"; }; void non