Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<random>: Enforce seed_seq::generate()'s mandate for RandomAccessIterator #4434

Closed
StephanTLavavej opened this issue Mar 3, 2024 · 0 comments · Fixed by #4447
Closed

<random>: Enforce seed_seq::generate()'s mandate for RandomAccessIterator #4434

StephanTLavavej opened this issue Mar 3, 2024 · 0 comments · Fixed by #4447
Labels
bug Something isn't working fixed Something works now, yay!

Comments

@StephanTLavavej
Copy link
Member

WG21-N4971 [rand.util.seedseq]/7:

template<class RandomAccessIterator>
  void generate(RandomAccessIterator begin, RandomAccessIterator end);

Mandates: iterator_traits<RandomAccessIterator>::value_type is an unsigned integer type capable of accommodating 32-bit quantities.

We currently don't enforce this:

STL/stl/inc/random

Lines 180 to 184 in 8b081e2

template <class _RanIt>
void generate(_RanIt _First, _RanIt _Last) const { // generate randomized interval from seeds
_Adl_verify_range(_First, _Last);
auto _UFirst = _Get_unwrapped(_First);
const auto _Nx = static_cast<size_t>(_Get_unwrapped(_Last) - _UFirst);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Something works now, yay!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant