diff options
| author | Robert Andrzejuk <robert-andrzejuk@users.noreply.github.com> | 2020-04-29 20:39:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-29 20:39:44 +0200 |
| commit | 84847041ee44e95fe8e857545f3a184cec1d9595 (patch) | |
| tree | c18792c829138533ea76255bfcd7df79fa68f587 | |
| parent | 1e5f44d3eaf2f87df3bd0fafb61ab1bd0fadcce2 (diff) | |
| download | platform_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_util | 4 |
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{}; |
