[libcxx-commits] [PATCH] D138212: [libc++] Use numeric_limits instead of raw INT_MAX
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 17 07:33:49 PST 2022
ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
This allows discard_block_engine to work on platforms that might not
provide a full <limits.h> header.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D138212
Files:
libcxx/include/__random/discard_block_engine.h
Index: libcxx/include/__random/discard_block_engine.h
===================================================================
--- libcxx/include/__random/discard_block_engine.h
+++ libcxx/include/__random/discard_block_engine.h
@@ -12,8 +12,8 @@
#include <__config>
#include <__random/is_seed_sequence.h>
#include <__utility/move.h>
-#include <climits>
#include <iosfwd>
+#include <limits>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -33,7 +33,7 @@
static_assert( 0 < __r, "discard_block_engine invalid parameters");
static_assert(__r <= __p, "discard_block_engine invalid parameters");
- static_assert(__r <= INT_MAX, "discard_block_engine invalid parameters");
+ static_assert(__r <= numeric_limits<int>::max(), "discard_block_engine invalid parameters");
public:
// types
typedef typename _Engine::result_type result_type;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138212.476126.patch
Type: text/x-patch
Size: 893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221117/9859f81b/attachment.bin>
More information about the libcxx-commits
mailing list