enum: add missing Enum.value property (#2739)

* enum: Add Enum.value property

* simplify

* address review
This commit is contained in:
Eric Cousineau
2020-12-31 10:08:15 -06:00
committed by GitHub
parent b7dfe5cc84
commit 2110d2d8ba
2 changed files with 17 additions and 7 deletions

View File

@@ -1731,6 +1731,7 @@ public:
m_base.init(is_arithmetic, is_convertible);
def(init([](Scalar i) { return static_cast<Type>(i); }), arg("value"));
def_property_readonly("value", [](Type value) { return (Scalar) value; });
def("__int__", [](Type value) { return (Scalar) value; });
#if PY_MAJOR_VERSION < 3
def("__long__", [](Type value) { return (Scalar) value; });