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

Untag dispatch <random> #2693

Merged
merged 10 commits into from
May 5, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions stl/inc/random
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,12 @@ public:
}

void seed(_Seed_t _Value = default_seed) { // set initial values from specified seed value
_Seed(_Value, false, true_type{});
_Seed<true>(_Value, false);
}

template <class _Gen>
void seed(_Gen& _Gx, bool _Readcy = false) { // set initial values from range
_Seed(_Gx, _Readcy, is_arithmetic<_Gen>{});
_Seed<is_arithmetic<_Gen>::value>(_Gx, _Readcy);
AlexGuteniev marked this conversation as resolved.
Show resolved Hide resolved
}

_NODISCARD result_type(min)() const {
Expand Down Expand Up @@ -751,15 +751,14 @@ public:
}

protected:
template <class _Gen>
void _Seed(_Gen& _Gx, bool _Readcy, true_type) { // reset sequence from numeric value
linear_congruential<_Seed_t, 40014U, 0U, 2147483563U> _Lc(_Gx == 0U ? default_seed : _Gx);
_Reset(_Lc, _Readcy);
}

template <class _Gen>
void _Seed(_Gen& _Gx, bool _Readcy, false_type) { // reset sequence from generator
_Reset(_Gx, _Readcy);
template <bool _IsNumeric, class _Gen>
AlexGuteniev marked this conversation as resolved.
Show resolved Hide resolved
void _Seed(_Gen& _Gx, bool _Readcy) { // reset sequence from numeric value or generator
if constexpr (_IsNumeric) {
linear_congruential<_Seed_t, 40014U, 0U, 2147483563U> _Lc(_Gx == 0U ? default_seed : _Gx);
AlexGuteniev marked this conversation as resolved.
Show resolved Hide resolved
_Reset(_Lc, _Readcy);
} else {
_Reset(_Gx, _Readcy);
}
}

template <class _Gen>
Expand Down Expand Up @@ -934,7 +933,7 @@ public:
}

void seed(_Ty _Value = default_seed) { // set initial values from specified seed value
this->_Seed(_Value, false, true_type{});
this->template _Seed<true>(_Value, false);
}

static constexpr int _Kx = (8 * sizeof(_Ty) + 31) / 32;
Expand Down