[C++-sig] Why isn't python-exposed boost::gregorian::date available everywhere?

MM finjulhich at gmail.com
Tue Sep 8 00:02:46 CEST 2015


I thought I'd post this SO question here as well, thanks:

I exposed boost::gregorian::date with the following:

date_from_python_date{};
to_python_converter<date, date_to_python_date, true>{};

where *date_to_python_date* is a struct with the right convert function: it
converts it to a python datetime.date. Some c++ functions return date and
calling them from python works.

At a later stage, I have a c++ class

class F {/// ....public:
    boost::gregorian::date start;};

which I register with:

class_<F, F*, bases<B>>("F")
  .def_readwrite("start", &F::start, "FTD");

I do this after having python-registered date. I then obtain an instance f
of the F wrapper. But then, when I print

f.start

The error is:

No Python class registered for C++ class boost::gregorian::date
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20150907/5bdaf596/attachment.html>


More information about the Cplusplus-sig mailing list