From 4799f66d167ea3d008fb6ce87e87490e54921f3f Mon Sep 17 00:00:00 2001 From: hsutter Date: Thu, 29 Sep 2016 12:59:21 -0700 Subject: [PATCH] Constexpr workaround MSVC 2015 Update 3 doesn't yet like the auto const variable in a constexpr function, removed the variable. --- util.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/util.h b/util.h index c57f256..81c4fbe 100644 --- a/util.h +++ b/util.h @@ -25,7 +25,7 @@ #endif // This project requires GSL, see: https://github.com/microsoft/gsl -#include +#include "gsl/gsl" #include #include @@ -49,10 +49,9 @@ bool operator>=(const Type& that) const { return compare3(that) >= 0; } template constexpr bool in_representable_range(Value const& value) { using C = std::common_type_t; - auto const cvalue = static_cast(value); - return cvalue <= static_cast(std::numeric_limits::max()) && - (!std::is_signed::value || static_cast(std::numeric_limits::min()) <= cvalue) && - (C{} < cvalue) == (Value{} < value); + return static_cast(value) <= static_cast(std::numeric_limits::max()) && + (!std::is_signed::value || static_cast(std::numeric_limits::min()) <= static_cast(value)) && + (C{} < static_cast(value)) == (Value{} < value); } #endif