[C++-sig] boost python exposing const*

MM finjulhich at gmail.com
Sat Sep 5 17:40:29 CEST 2015


I have a c++ class T that I succesfully expose via:

class_<T, T*> ...


later on, I have

struct S {
  const T* underlying;
};

class_<S,S*>("S").
    .def_readonly("underlying", &S::underlying)
;

>From python, when I call:

s.underlying

where s is a python instance of S, i get the following error:

TypeError: No to_python (by-value) converter found for C++ type: T const*

Do I need another converter for T const* in particular? or for both T* and
T const*?
Does the class_<T,T*> above only expose T itself, not pointers to it?

Thanks
MM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20150905/41073af2/attachment.html>


More information about the Cplusplus-sig mailing list