bitshares1-core
bitshares1-core copied to clipboard
Use C++11 enum class for enums
C++11 contains enum class
, see for example: http://www.cprogramming.com/c++11/c++11-nullptr-strongly-typed-enum-class.html
The enum class
construct has two advantages:
- Specify a specific size of integer
- Enum values are placed in a namespace
The main thing keeping this from being a dumb search/replace refactoring is that AFAICT the (completely undocumented) enum serialization mechanism of FC is not aware of enum class
.
This is obviously a relatively low priority code tidiness issue. My main purpose of posting it here is to get it out of my head and into a ticket.
At the time fc was written not all compilers supported the enum class (VC++ looking at you).
We would have to update fc reflection to identify this and then fc serialization to leverage it. It also wouldn't work for cases where we want to serialize as a varint.