aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Andrzejuk <robert-andrzejuk@users.noreply.github.com>2020-04-29 20:39:44 +0200
committerGitHub <noreply@github.com>2020-04-29 20:39:44 +0200
commit84847041ee44e95fe8e857545f3a184cec1d9595 (patch)
treec18792c829138533ea76255bfcd7df79fa68f587
parent1e5f44d3eaf2f87df3bd0fafb61ab1bd0fadcce2 (diff)
downloadplatform_external_Microsoft-GSL-84847041ee44e95fe8e857545f3a184cec1d9595.tar.gz
platform_external_Microsoft-GSL-84847041ee44e95fe8e857545f3a184cec1d9595.tar.bz2
platform_external_Microsoft-GSL-84847041ee44e95fe8e857545f3a184cec1d9595.zip
In `narrow` refactor `!is_same_signedness` to `is_different_signedness`
-rw-r--r--include/gsl/gsl_util4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/gsl/gsl_util b/include/gsl/gsl_util
index cdb94ac..19e4831 100644
--- a/include/gsl/gsl_util
+++ b/include/gsl/gsl_util
@@ -109,12 +109,12 @@ constexpr
#endif
T narrow(U u) noexcept(false)
{
- constexpr const bool is_same_signedness = std::is_signed<T>::value == std::is_signed<U>::value;
+ constexpr const bool is_different_signedness = (std::is_signed<T>::value != std::is_signed<U>::value);
const T t = narrow_cast<T>(u);
if (static_cast<U>(t) != u
- || (!is_same_signedness
+ || (is_different_signedness
&& ((t < T{}) != (u < U{}))))
{
throw narrowing_error{};