From 6918922332a46eda4732cb15cec0fbcd8c5dd30d Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Thu, 1 Oct 2015 21:32:23 +0200 Subject: [PATCH] allow enums values to be cast to integers --- include/pybind/pybind.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/pybind/pybind.h b/include/pybind/pybind.h index 666cd69d0..495311648 100644 --- a/include/pybind/pybind.h +++ b/include/pybind/pybind.h @@ -812,6 +812,7 @@ public: ((it == entries->end()) ? std::string("???") : std::string(it->second)); }); + this->def("__int__", [](Type value) { return (int) value; }); m_entries = entries; }