From f6c4c1047a293ea77223c21f84f888e062212d78 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 4 Sep 2019 16:16:21 -0400 Subject: restores __invert__ to arithmetic-enabled enum, fixes #1907 (#1909) --- include/pybind11/pybind11.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index fbd971c..a7fe189 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1484,6 +1484,8 @@ struct enum_base { PYBIND11_ENUM_OP_CONV("__ror__", a | b); PYBIND11_ENUM_OP_CONV("__xor__", a ^ b); PYBIND11_ENUM_OP_CONV("__rxor__", a ^ b); + m_base.attr("__invert__") = cpp_function( + [](object arg) { return ~(int_(arg)); }, is_method(m_base)); } } else { PYBIND11_ENUM_OP_STRICT("__eq__", int_(a).equal(int_(b)), return false); -- cgit v1.2.3