File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1503,9 +1503,11 @@ NAMESPACE_END(detail)
1503
1503
// / Binds C++ enumerations and enumeration classes to Python
1504
1504
template <typename Type> class enum_ : public class_<Type> {
1505
1505
public:
1506
- using class_<Type>::def;
1507
- using class_<Type>::def_property_readonly;
1508
- using class_<Type>::def_property_readonly_static;
1506
+ using Base = class_<Type>;
1507
+ using Base::def;
1508
+ using Base::attr;
1509
+ using Base::def_property_readonly;
1510
+ using Base::def_property_readonly_static;
1509
1511
using Scalar = typename std::underlying_type<Type>::type;
1510
1512
1511
1513
template <typename ... Extra>
@@ -1520,7 +1522,10 @@ template <typename Type> class enum_ : public class_<Type> {
1520
1522
#if PY_MAJOR_VERSION < 3
1521
1523
def (" __long__" , [](Type value) { return (Scalar) value; });
1522
1524
#endif
1523
- def (" __setstate__" , [](Type &value, Scalar arg) { value = static_cast <Type>(arg); });
1525
+ cpp_function setstate (
1526
+ [](Type &value, Scalar arg) { value = static_cast <Type>(arg); },
1527
+ is_method (*this ));
1528
+ attr (" __setstate__" ) = setstate ;
1524
1529
}
1525
1530
1526
1531
// / Export enumeration entries into the parent scope
You can’t perform that action at this time.
0 commit comments