-
Notifications
You must be signed in to change notification settings - Fork 2.2k
boost::optional example doesn't work on older Boost #847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looks like I can't actually assign to myself, presumably because I'm not a committer. I'll work on a PR next week though. |
bmerry
added a commit
to ska-sa/katsdppipelines
that referenced
this issue
May 12, 2017
Replaced with std::optional, std::experimental::option or boost::optional, depending on compiler support. There is still more boilerplate than necessary due to pybind/pybind11#847, which can hopefully go away once that gets fixed.
Some potentials from the gitter discussion:
|
I've added example code to reproduce the issue. It seems that Boost 1.58 sometimes works with |
bmerry
added a commit
to bmerry/pybind11
that referenced
this issue
May 14, 2017
With older versions of Boost, `value = {}` can fail to compile because the interpretation of `{}` is ambiguous (could construct `boost::none` or the value type). It can also fail with `std::experimental::optional`, at least on GCC 5.4, because it would construct an instance of the optional type and then move-assign it, and if the value type isn't move assignable this would fail. This is replaced by preferring `.reset` if the type supports it, and also providing a traits class that can be extended to override the behaviour where necessary (which is done for std::experimental::optional). Additionally, the assignment of the value from the inner caster was by copy rather than move, which prevented use with uncopyable types. Closes pybind#847.
Fixed via #874. |
bmerry
added a commit
to ska-sa/katsdpimager
that referenced
this issue
Sep 12, 2019
Replaced with std::optional, std::experimental::option or boost::optional, depending on compiler support. There is still more boilerplate than necessary due to pybind/pybind11#847, which can hopefully go away once that gets fixed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
The documentation describes how to wrap
boost::python
. It fails to compile on Boost 1.58 due to the linevalue = {};
which was only fixed to work in Boost 1.63.Reproducible example code
C++:
Python:
There has been some discussion in gitter about approaches to fix this. I'm going to assign to myself to create a PR.
The text was updated successfully, but these errors were encountered: