[C++-sig] Wrapping functions that return a raw pointer

hessiess at hessiess.com hessiess at hessiess.com
Sun May 3 03:34:14 CEST 2009


How can I wrap a function which returns a raw pointer? for example the
following generates tonnes of errors on compile:

struct test
{
    int *get()
    {
	return new int(1);
    }
};

BOOST_PYTHON_MODULE(test)
{
    using namespace boost::python;

    class_<test>("test")
	.def("get", &test::get);
}

Thanks



More information about the Cplusplus-sig mailing list