mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
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
This commit is contained in:
parent
b673375719
commit
5a7093f983
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user