diff options
author | kile0 <kile@microsoft.com> | 2018-11-28 11:52:11 -0800 |
---|---|---|
committer | Anna Gringauze <annagrin@microsoft.com> | 2018-11-28 11:52:11 -0800 |
commit | 5a7093f983aff4f000f804caf3ab0ab703660cfc (patch) | |
tree | d4fa9e12f428549c0c6befb02775571c260413ca | |
parent | b67337571920363b7a7845de187f058e5dc3ba00 (diff) | |
download | Microsoft-GSL-5a7093f983aff4f000f804caf3ab0ab703660cfc.tar.gz |
Use the c++17 constexpr if in CheckRange if possible (#753)
* change c++17 to use constexpr if in CheckRange
* remove unnecessary macro
* use the portable feature test macro rather than direct version check
-rw-r--r-- | include/gsl/span | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/gsl/span b/include/gsl/span index b356ee9..54f5f6b 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -556,7 +556,11 @@ private: // wrap around to a value always greater than size when casted. // check if we have enough space to wrap around +#if defined(__cpp_if_constexpr) + if constexpr (sizeof(index_type) <= sizeof(size_t)) +#else if (sizeof(index_type) <= sizeof(size_t)) +#endif { return narrow_cast<size_t>(idx) < narrow_cast<size_t>(size); } |