mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-19 16:19:37 +08:00
check_size_for_overflow: use numeric limits instead of c99 macro
This commit is contained in:
parent
489dbbc651
commit
8b4efc8ed8
@ -391,7 +391,7 @@ EIGEN_DEVICE_FUNC inline T* move_construct_elements_of_array(T* ptr, T* src, std
|
||||
|
||||
template <typename T>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void check_size_for_overflow(std::size_t size) {
|
||||
constexpr std::size_t max_elements = PTRDIFF_MAX / sizeof(T);
|
||||
constexpr std::size_t max_elements = (std::numeric_limits<std::ptrdiff_t>::max)() / sizeof(T);
|
||||
if (size > max_elements) throw_std_bad_alloc();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user