@@ -1358,7 +1358,7 @@ template <typename Type> class enum_ : public class_<Type> {
13581358
13591359 template <typename ... Extra>
13601360 enum_ (const handle &scope, const char *name, const Extra&... extra)
1361- : class_<Type>(scope, name, extra...), m_entries(), m_parent(scope), m_name(name) {
1361+ : class_<Type>(scope, name, extra...), m_entries(), m_parent(scope) {
13621362
13631363 constexpr bool is_arithmetic = detail::any_of<std::is_same<arithmetic, Extra>...>::value;
13641364
@@ -1377,14 +1377,14 @@ template <typename Type> class enum_ : public class_<Type> {
13771377 return m;
13781378 }, return_value_policy::copy);
13791379 def (init ([](Scalar i) { return static_cast <Type>(i); }));
1380- def (init ([this , m_entries_ptr](std::string value) -> Type {
1380+ def (init ([name , m_entries_ptr](std::string value) -> Type {
13811381 for (const auto &kv : reinterpret_borrow<dict>(m_entries_ptr)) {
13821382 std::string key = cast<str>(kv.first );
1383- if (value == key || key == m_name + " ::" + value) {
1383+ if (value == key || key == std::string (name) + " ::" + value) {
13841384 return cast<Type>(kv.second );
13851385 }
13861386 }
1387- throw value_error (" \" " + value + " \" is not a valid value for enum type " + m_name );
1387+ throw value_error (" \" " + value + " \" is not a valid value for enum type " + name );
13881388 }));
13891389 def (" __int__" , [](Type value) { return (Scalar) value; });
13901390 #if PY_MAJOR_VERSION < 3
@@ -1445,7 +1445,6 @@ template <typename Type> class enum_ : public class_<Type> {
14451445private:
14461446 dict m_entries;
14471447 handle m_parent;
1448- std::string m_name;
14491448};
14501449
14511450NAMESPACE_BEGIN (detail)
0 commit comments