From fbd4518d1381b97926e2a166f949db3904d6e5d6 Mon Sep 17 00:00:00 2001 From: terik23 Date: Thu, 25 Apr 2019 21:57:07 +0500 Subject: [PATCH] clean-up --- include/nameof.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/nameof.hpp b/include/nameof.hpp index f330dea..b7ec353 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -233,9 +233,8 @@ template constexpr int min = enum_range::min > (std::numeric_limits::min)() ? enum_range::min : (std::numeric_limits::min)(); constexpr auto range = std::make_integer_sequence{}; constexpr auto names = detail::enum_names_impl(range); - const int i = static_cast(value) - min; - if (i >= 0 && static_cast(i) < names.size()) { + if (int i = static_cast(value) - min; i >= 0 && static_cast(i) < names.size()) { return names[i]; } else { return {}; // Value out of range.