[C++-sig] Pointers to simple types, arrays and arrays of pointers to types

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Sun Oct 5 15:28:56 CEST 2003


--- Nicodemus <nicodemus at globalite.com.br> wrote:
> The wonders of Boost.Python (untested):
> 
> PyObject* find_wrapper(MyClass* cl)
> {
>      float *res = cl.find();
>      if (res == NULL) {
>           Py_INCREF(Py_None);
>           return Py_None;
>      }
>      else {
>           return PyFloat_FromDouble((float)v);
>      }
> }
> 
> (I couldn't create a None using Boost Python's api, I tried object(NULL) 
> but it didn't work... how can one do that?)

The problem is that it is too easy:

boost::python::object none;

Ralf


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com




More information about the Cplusplus-sig mailing list