Skip to content
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

make arithmetic operators of enum_ optional #508

Merged
merged 1 commit into from
Nov 17, 2016
Merged

Conversation

wjakob
Copy link
Member

@wjakob wjakob commented Nov 17, 2016

Following commit 90d278, the object code generated by the python
bindings of nanogui (github.com/wjakob/nanogui) went up by a whopping
12%. It turns out that that project has quite a few enums where we don't
really care about arithmetic operators.

This commit thus partially reverts the effects of #503 by introducing
an additional attribute py::arithmetic() that must be specified if the
arithmetic operators are desired.

@wjakob
Copy link
Member Author

wjakob commented Nov 17, 2016

cc @pschella

@pschella
Copy link
Contributor

Looks fine to me. Although if we are going to incur the huge diff by renaming UnderlyingType to Scalar we might as well change the pointer arguments to const & at the same time.

Following commit 90d278, the object code generated by the python
bindings of nanogui (github.com/wjakob/nanogui) went up by a whopping
12%. It turns out that that project has quite a few enums where we don't
really care about arithmetic operators.

This commit thus partially reverts the effects of pybind#503 by introducing
an additional attribute py::arithmetic() that must be specified if the
arithmetic operators are desired.
@wjakob
Copy link
Member Author

wjakob commented Nov 17, 2016

These were intentionally pointers so that comparisons against None return False instead of throwing an exception. I forgot the context, but this was important for some Python internals.

@wjakob wjakob merged commit 405f6d1 into pybind:master Nov 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants