We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7e7886e + ab5b437 commit da87408Copy full SHA for da87408
docs/changelog.txt
@@ -65,6 +65,7 @@ Template for new versions:
65
## Documentation
66
67
## API
68
+- add flexible casting to ``enum_field`` to enable explicit casting to more types
69
70
## Lua
71
library/include/DataDefs.h
@@ -632,6 +632,10 @@ namespace df
632
enum_field<EnumType,IntType> &operator=(EnumType ev) {
633
value = IntType(ev); return *this;
634
}
635
+ explicit operator IntType () const { return IntType(value); }
636
+ template <typename T>
637
+ explicit operator T () const { return static_cast<T>(IntType(value)); }
638
+
639
};
640
641
template<class ET, class IT>
0 commit comments