forked from OSchip/llvm-project
[libc++] Use numeric_limits instead of raw INT_MAX
This allows discard_block_engine to work on platforms that might not provide a full <limits.h> header. Differential Revision: https://reviews.llvm.org/D138212
This commit is contained in:
parent
44e2c6a428
commit
eaa4f041f7
|
@ -12,8 +12,8 @@
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__random/is_seed_sequence.h>
|
#include <__random/is_seed_sequence.h>
|
||||||
#include <__utility/move.h>
|
#include <__utility/move.h>
|
||||||
#include <climits>
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
#include <limits>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
@ -33,7 +33,9 @@ class _LIBCPP_TEMPLATE_VIS discard_block_engine
|
||||||
|
|
||||||
static_assert( 0 < __r, "discard_block_engine invalid parameters");
|
static_assert( 0 < __r, "discard_block_engine invalid parameters");
|
||||||
static_assert(__r <= __p, "discard_block_engine invalid parameters");
|
static_assert(__r <= __p, "discard_block_engine invalid parameters");
|
||||||
static_assert(__r <= INT_MAX, "discard_block_engine invalid parameters");
|
#ifndef _LIBCPP_CXX03_LANG // numeric_limits::max() is not constexpr in C++03
|
||||||
|
static_assert(__r <= numeric_limits<int>::max(), "discard_block_engine invalid parameters");
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
typedef typename _Engine::result_type result_type;
|
typedef typename _Engine::result_type result_type;
|
||||||
|
|
|
@ -1729,6 +1729,7 @@ class piecewise_linear_distribution
|
||||||
|
|
||||||
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
|
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
|
||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
|
# include <climits>
|
||||||
# include <cmath>
|
# include <cmath>
|
||||||
# include <concepts>
|
# include <concepts>
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
|
|
|
@ -502,7 +502,6 @@ queue type_traits
|
||||||
queue vector
|
queue vector
|
||||||
queue version
|
queue version
|
||||||
random bit
|
random bit
|
||||||
random climits
|
|
||||||
random cmath
|
random cmath
|
||||||
random cstddef
|
random cstddef
|
||||||
random cstdint
|
random cstdint
|
||||||
|
|
|
Loading…
Reference in New Issue