Improve and simplify code with modern C++ features
Change-Id: I28d84df3087492ab2ecbeb91169a2cde12c9e31e
diff --git a/src/encoding/nfd-constants.cpp b/src/encoding/nfd-constants.cpp
index 5c3189a..eebd4f3 100644
--- a/src/encoding/nfd-constants.cpp
+++ b/src/encoding/nfd-constants.cpp
@@ -121,7 +121,7 @@
routeOrigin = ROUTE_ORIGIN_STATIC;
else {
// To reject negative numbers, we parse as a wider signed type, and compare with the range.
- static_assert(std::numeric_limits<std::underlying_type<RouteOrigin>::type>::max() <=
+ static_assert(std::numeric_limits<std::underlying_type_t<RouteOrigin>>::max() <=
std::numeric_limits<int>::max(), "");
int v = -1;
@@ -131,8 +131,8 @@
catch (const boost::bad_lexical_cast&) {
}
- if (v >= std::numeric_limits<std::underlying_type<RouteOrigin>::type>::min() &&
- v <= std::numeric_limits<std::underlying_type<RouteOrigin>::type>::max()) {
+ if (v >= std::numeric_limits<std::underlying_type_t<RouteOrigin>>::min() &&
+ v <= std::numeric_limits<std::underlying_type_t<RouteOrigin>>::max()) {
routeOrigin = static_cast<RouteOrigin>(v);
}
else {