[C++-sig] Getting a Python type object for a c++ type in wrapper code...

Mike Rovner mrovner at propel.com
Tue Oct 4 20:47:27 CEST 2005


Alex Mohr wrote:
> Something like def_readonly("fooType", <var-which-holds-type-for-Foo>) 
> would be ideal.  I'd also like to be able to do this for python types, 
> like python's float.  Is there a simple way to do this in my 
> Boost.Python code?

object foo_type =
class_<Foo>("Foo")
   /*.defs*/
   ;
scope().attr("fooType") = foo_type;

HTH,
Mike




More information about the Cplusplus-sig mailing list