[libcxx-commits] [libcxx] [libc++] Add a static_assert for a Mandates in seed_seq (PR #86992)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Mar 30 11:40:14 PDT 2024
================
@@ -79,6 +81,11 @@ void seed_seq::__init(_InputIterator __first, _InputIterator __last) {
template <class _RandomAccessIterator>
void seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ using _ValueType = typename iterator_traits<_RandomAccessIterator>::value_type;
+ static_assert(is_unsigned<_ValueType>::value && sizeof(_ValueType) * CHAR_BIT >= 32,
----------------
mordante wrote:
Since we use `uint32_t` unconditionally in our code, this seems more readable.
```suggestion
static_assert(is_unsigned<_ValueType>::value && sizeof(_ValueType) >= sizeof(uint32_t),
```
https://github.com/llvm/llvm-project/pull/86992
More information about the libcxx-commits
mailing list