diff --git a/include/gsl_util.h b/include/gsl_util.h index 4ac6187..b144108 100644 --- a/include/gsl_util.h +++ b/include/gsl_util.h @@ -91,12 +91,12 @@ inline constexpr T narrow_cast(U u) noexcept struct narrowing_error : public std::exception {}; -template -struct is_same_signess +namespace details { - static const bool value = - std::is_signed::value == std::is_signed::value; -}; + template + struct is_same_signedness : public std::integral_constant::value == std::is_signed::value> + {}; +} // narrow() : a checked version of narrow_cast() that throws if the cast changed the value template @@ -105,7 +105,7 @@ inline T narrow(U u) T t = narrow_cast(u); if (static_cast(t) != u) throw narrowing_error(); - if (!is_same_signess::value && ((t < T{}) != (u < U{}))) + if (!details::is_same_signedness::value && ((t < T{}) != (u < U{}))) throw narrowing_error(); return t; }