From 5a7093f983aff4f000f804caf3ab0ab703660cfc Mon Sep 17 00:00:00 2001 From: kile0 Date: Wed, 28 Nov 2018 11:52:11 -0800 Subject: [PATCH] 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 --- include/gsl/span | 4 ++++ 1 file changed, 4 insertions(+) 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(idx) < narrow_cast(size); }