Don't use std::underlying_type

For compatibility with GCC < 4.7 and Clang < 3.4