@@ -1358,7 +1358,7 @@ template <typename Type> class enum_ : public class_<Type> {
1358
1358
1359
1359
template <typename ... Extra>
1360
1360
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) {
1362
1362
1363
1363
constexpr bool is_arithmetic = detail::any_of<std::is_same<arithmetic, Extra>...>::value;
1364
1364
@@ -1377,14 +1377,14 @@ template <typename Type> class enum_ : public class_<Type> {
1377
1377
return m;
1378
1378
}, return_value_policy::copy);
1379
1379
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 {
1381
1381
for (const auto &kv : reinterpret_borrow<dict>(m_entries_ptr)) {
1382
1382
std::string key = cast<str>(kv.first );
1383
- if (value == key || key == m_name + " ::" + value) {
1383
+ if (value == key || key == std::string (name) + " ::" + value) {
1384
1384
return cast<Type>(kv.second );
1385
1385
}
1386
1386
}
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 );
1388
1388
}));
1389
1389
def (" __int__" , [](Type value) { return (Scalar) value; });
1390
1390
#if PY_MAJOR_VERSION < 3
@@ -1445,7 +1445,6 @@ template <typename Type> class enum_ : public class_<Type> {
1445
1445
private:
1446
1446
dict m_entries;
1447
1447
handle m_parent;
1448
- std::string m_name;
1449
1448
};
1450
1449
1451
1450
NAMESPACE_BEGIN (detail)
0 commit comments