@@ -534,7 +534,7 @@ private:
534
534
};
535
535
536
536
template <class _Uint, _Uint _Ax, _Uint _Cx, _Uint _Mx>
537
- class linear_congruential { // linear congruential random engine
537
+ class _DEPRECATE_TR1_RANDOM linear_congruential { // linear congruential random engine
538
538
public:
539
539
_RNG_REQUIRE_UINTTYPE(linear_congruential, _Uint);
540
540
@@ -898,7 +898,7 @@ struct _Swc_traits { // traits for subtract_with_carry generator
898
898
};
899
899
900
900
template <class _Ty, _Ty _Mx, size_t _Sx, size_t _Rx>
901
- class subtract_with_carry
901
+ class _DEPRECATE_TR1_RANDOM subtract_with_carry
902
902
: public _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, _Mx, _Rx>> { // subtract_with_carry generator
903
903
public:
904
904
using _Mybase = _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, _Mx, _Rx>>;
@@ -915,9 +915,10 @@ public:
915
915
subtract_with_carry(_Gen& _Gx) : _Mybase(_Gx) {}
916
916
};
917
917
918
+ _STL_DISABLE_DEPRECATED_WARNING
918
919
_EXPORT_STD template <class _Ty, size_t _Wx, size_t _Sx, size_t _Rx>
919
920
class subtract_with_carry_engine
920
- : public subtract_with_carry<_Ty, static_cast<_Ty>((_Ty{1} << (_Wx - 1)) << 1), _Sx, _Rx> {
921
+ : private subtract_with_carry<_Ty, static_cast<_Ty>((_Ty{1} << (_Wx - 1)) << 1), _Sx, _Rx> {
921
922
// subtract_with_carry generator
922
923
public:
923
924
_RNG_REQUIRE_UINTTYPE(subtract_with_carry_engine, _Ty);
@@ -981,6 +982,26 @@ public:
981
982
return _Mx - 1;
982
983
}
983
984
985
+ _NODISCARD_FRIEND bool operator==(
986
+ const subtract_with_carry_engine& _Left, const subtract_with_carry_engine& _Right) noexcept /* strengthened */ {
987
+ return static_cast<const _Mybase&>(_Left) == static_cast<const _Mybase&>(_Right);
988
+ }
989
+
990
+ #if !_HAS_CXX20
991
+ _NODISCARD_FRIEND bool operator!=(
992
+ const subtract_with_carry_engine& _Left, const subtract_with_carry_engine& _Right) noexcept /* strengthened */ {
993
+ return static_cast<const _Mybase&>(_Left) != static_cast<const _Mybase&>(_Right);
994
+ }
995
+ #endif // !_HAS_CXX20
996
+
997
+ _NODISCARD result_type operator()() {
998
+ return _Mybase::operator()();
999
+ }
1000
+
1001
+ void discard(unsigned long long _Nskip) {
1002
+ _Mybase::discard(_Nskip);
1003
+ }
1004
+
984
1005
template <class _Elem, class _Traits>
985
1006
friend basic_ostream<_Elem, _Traits>& operator<<(
986
1007
basic_ostream<_Elem, _Traits>& _Ostr, const subtract_with_carry_engine& _Eng) {
@@ -1019,6 +1040,7 @@ public:
1019
1040
return _Istr;
1020
1041
}
1021
1042
};
1043
+ _STL_RESTORE_DEPRECATED_WARNING
1022
1044
1023
1045
#if _HAS_TR1_NAMESPACE
1024
1046
constexpr double _Cx_exp2(const int _Exp) noexcept {
@@ -1108,7 +1130,7 @@ public:
1108
1130
#endif // _HAS_TR1_NAMESPACE
1109
1131
1110
1132
template <class _Ty, int _Wx, int _Nx, int _Mx, int _Rx, _Ty _Px, int _Ux, int _Sx, _Ty _Bx, int _Tx, _Ty _Cx, int _Lx>
1111
- class mersenne_twister : public _Circ_buf<_Ty, _Nx> { // mersenne twister generator
1133
+ class _DEPRECATE_TR1_RANDOM mersenne_twister : public _Circ_buf<_Ty, _Nx> { // mersenne twister generator
1112
1134
public:
1113
1135
using result_type = _Ty;
1114
1136
@@ -1278,9 +1300,10 @@ protected:
1278
1300
static constexpr int _M_mod_n = _Mx % _Nx;
1279
1301
};
1280
1302
1303
+ _STL_DISABLE_DEPRECATED_WARNING
1281
1304
_EXPORT_STD template <class _Ty, size_t _Wx, size_t _Nx, size_t _Mx, size_t _Rx, _Ty _Px, size_t _Ux, _Ty _Dx,
1282
1305
size_t _Sx, _Ty _Bx, size_t _Tx, _Ty _Cx, size_t _Lx, _Ty _Fx>
1283
- class mersenne_twister_engine : public mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx, _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx> {
1306
+ class mersenne_twister_engine : private mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx, _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx> {
1284
1307
public:
1285
1308
static constexpr unsigned long long _Max = (((1ULL << (_Wx - 1)) - 1) << 1) + 1;
1286
1309
@@ -1360,10 +1383,43 @@ public:
1360
1383
_NODISCARD static constexpr result_type(max)() noexcept /* strengthened */ {
1361
1384
return _Mybase::_WMSK;
1362
1385
}
1386
+
1387
+ _NODISCARD_FRIEND bool operator==(
1388
+ const mersenne_twister_engine& _Left, const mersenne_twister_engine& _Right) noexcept /* strengthened */ {
1389
+ return static_cast<const _Mybase&>(_Left) == static_cast<const _Mybase&>(_Right);
1390
+ }
1391
+
1392
+ #if !_HAS_CXX20
1393
+ _NODISCARD_FRIEND bool operator!=(
1394
+ const mersenne_twister_engine& _Left, const mersenne_twister_engine& _Right) noexcept /* strengthened */ {
1395
+ return static_cast<const _Mybase&>(_Left) != static_cast<const _Mybase&>(_Right);
1396
+ }
1397
+ #endif // !_HAS_CXX20
1398
+
1399
+ template <class _Elem, class _S_Traits>
1400
+ friend basic_istream<_Elem, _S_Traits>& operator>>(
1401
+ basic_istream<_Elem, _S_Traits>& _Istr, mersenne_twister_engine& _Eng) {
1402
+ return _Istr >> static_cast<_Mybase&>(_Eng);
1403
+ }
1404
+
1405
+ template <class _Elem, class _S_Traits>
1406
+ friend basic_ostream<_Elem, _S_Traits>& operator<<(
1407
+ basic_ostream<_Elem, _S_Traits>& _Ostr, const mersenne_twister_engine& _Eng) {
1408
+ return _Ostr << static_cast<const _Mybase&>(_Eng);
1409
+ }
1410
+
1411
+ _NODISCARD result_type operator()() {
1412
+ return _Mybase::operator()();
1413
+ }
1414
+
1415
+ void discard(unsigned long long _Nskip) {
1416
+ _Mybase::discard(_Nskip);
1417
+ }
1363
1418
};
1419
+ _STL_RESTORE_DEPRECATED_WARNING
1364
1420
1365
1421
template <class _Engine, int _Px, int _Rx>
1366
- class discard_block { // discard_block compound engine
1422
+ class _DEPRECATE_TR1_RANDOM discard_block { // discard_block compound engine
1367
1423
public:
1368
1424
#if _HAS_TR1_NAMESPACE
1369
1425
using base_type _DEPRECATE_TR1_NAMESPACE = _Engine; // TR1-only typedef
@@ -1539,9 +1595,10 @@ private:
1539
1595
size_t _Nx;
1540
1596
};
1541
1597
1598
+ _STL_DISABLE_DEPRECATED_WARNING
1542
1599
_EXPORT_STD template <class _Engine, size_t _Px, size_t _Rx>
1543
1600
class discard_block_engine // discard_block_engine compound engine
1544
- : public conditional_t<_Px <= INT_MAX, discard_block<_Engine, static_cast<int>(_Px), static_cast<int>(_Rx)>,
1601
+ : private conditional_t<_Px <= INT_MAX, discard_block<_Engine, static_cast<int>(_Px), static_cast<int>(_Rx)>,
1545
1602
_Discard_block_base<_Engine, _Px, _Rx>> {
1546
1603
public:
1547
1604
static_assert(0 < _Rx && _Rx <= _Px, "invalid template argument for discard_block_engine");
@@ -1564,14 +1621,61 @@ public:
1564
1621
template <class _Seed_seq, _Enable_if_seed_seq_t<_Seed_seq, discard_block_engine, _Engine> = 0>
1565
1622
explicit discard_block_engine(_Seed_seq& _Seq) : _Mybase(_Seq) {}
1566
1623
1624
+ void seed() {
1625
+ _Mybase::seed();
1626
+ }
1627
+
1628
+ void seed(result_type _Xx0) {
1629
+ _Mybase::seed(_Xx0);
1630
+ }
1631
+
1632
+ template <class _Seed_seq, _Enable_if_seed_seq_t<_Seed_seq, discard_block_engine> = 0>
1633
+ void seed(_Seed_seq& _Seq) {
1634
+ _Mybase::seed(_Seq);
1635
+ }
1636
+
1637
+ _NODISCARD const _Engine& base() const noexcept {
1638
+ return _Mybase::base();
1639
+ }
1640
+
1641
+ _NODISCARD result_type operator()() {
1642
+ return _Mybase::operator()();
1643
+ }
1644
+
1645
+ void discard(unsigned long long _Nskip) {
1646
+ _Mybase::discard(_Nskip);
1647
+ }
1648
+
1567
1649
_NODISCARD static constexpr result_type(min)() noexcept /* strengthened */ {
1568
1650
return (_Engine::min)();
1569
1651
}
1570
1652
1571
1653
_NODISCARD static constexpr result_type(max)() noexcept /* strengthened */ {
1572
1654
return (_Engine::max)();
1573
1655
}
1656
+
1657
+ _NODISCARD_FRIEND bool operator==(const discard_block_engine& _Left, const discard_block_engine& _Right) {
1658
+ return static_cast<const _Mybase&>(_Left) == static_cast<const _Mybase&>(_Right);
1659
+ }
1660
+
1661
+ #if !_HAS_CXX20
1662
+ _NODISCARD_FRIEND bool operator!=(const discard_block_engine& _Left, const discard_block_engine& _Right) {
1663
+ return static_cast<const _Mybase&>(_Left) != static_cast<const _Mybase&>(_Right);
1664
+ }
1665
+ #endif // !_HAS_CXX20
1666
+
1667
+ template <class _Elem, class _Traits>
1668
+ friend basic_istream<_Elem, _Traits>& operator>>(basic_istream<_Elem, _Traits>& _Istr, discard_block_engine& _Eng) {
1669
+ return _Istr >> static_cast<_Mybase&>(_Eng);
1670
+ }
1671
+
1672
+ template <class _Elem, class _Traits>
1673
+ friend basic_ostream<_Elem, _Traits>& operator<<(
1674
+ basic_ostream<_Elem, _Traits>& _Ostr, const discard_block_engine& _Eng) {
1675
+ return _Ostr << static_cast<const _Mybase&>(_Eng);
1676
+ }
1574
1677
};
1678
+ _STL_RESTORE_DEPRECATED_WARNING
1575
1679
1576
1680
_EXPORT_STD template <class _Engine, size_t _Wx, class _UIntType>
1577
1681
class independent_bits_engine { // independent_bits_engine compound engine
@@ -1969,7 +2073,7 @@ private:
1969
2073
};
1970
2074
1971
2075
template <class _Ty = int>
1972
- class uniform_int { // uniform integer distribution
2076
+ class _DEPRECATE_TR1_RANDOM uniform_int { // uniform integer distribution
1973
2077
public:
1974
2078
using result_type = _Ty;
1975
2079
@@ -2112,8 +2216,9 @@ private:
2112
2216
param_type _Par;
2113
2217
};
2114
2218
2219
+ _STL_DISABLE_DEPRECATED_WARNING
2115
2220
_EXPORT_STD template <class _Ty = int>
2116
- class uniform_int_distribution : public uniform_int<_Ty> { // uniform integer distribution
2221
+ class uniform_int_distribution : private uniform_int<_Ty> { // uniform integer distribution
2117
2222
public:
2118
2223
_RNG_REQUIRE_INTTYPE(uniform_int_distribution, _Ty);
2119
2224
@@ -2143,6 +2248,54 @@ public:
2143
2248
explicit uniform_int_distribution(const param_type& _Par0) noexcept // strengthened
2144
2249
: _Mybase(_Par0) {}
2145
2250
2251
+ _NODISCARD result_type a() const noexcept /* strengthened */ {
2252
+ return _Mybase::a();
2253
+ }
2254
+
2255
+ _NODISCARD result_type b() const noexcept /* strengthened */ {
2256
+ return _Mybase::b();
2257
+ }
2258
+
2259
+ _NODISCARD param_type param() const noexcept /* strengthened */ {
2260
+ return _Mybase::param();
2261
+ }
2262
+
2263
+ void param(const param_type& _Par0) noexcept /* strengthened */ {
2264
+ _Mybase::param(_Par0);
2265
+ }
2266
+
2267
+ _NODISCARD result_type(min)() const noexcept /* strengthened */ {
2268
+ return (_Mybase::min)();
2269
+ }
2270
+
2271
+ _NODISCARD result_type(max)() const noexcept /* strengthened */ {
2272
+ return (_Mybase::max)();
2273
+ }
2274
+
2275
+ void reset() noexcept /* strengthened */ {}
2276
+
2277
+ template <class _Engine>
2278
+ _NODISCARD result_type operator()(_Engine& _Eng) _DISTRIBUTION_CONST {
2279
+ return _Mybase::operator()(_Eng);
2280
+ }
2281
+
2282
+ template <class _Engine>
2283
+ _NODISCARD result_type operator()(_Engine& _Eng, const param_type& _Par0) _DISTRIBUTION_CONST {
2284
+ return _Mybase::operator()(_Eng, _Par0);
2285
+ }
2286
+
2287
+ template <class _Elem, class _Traits>
2288
+ friend basic_istream<_Elem, _Traits>& operator>>(
2289
+ basic_istream<_Elem, _Traits>& _Istr, uniform_int_distribution& _Dist) {
2290
+ return _Istr >> static_cast<_Mybase&>(_Dist);
2291
+ }
2292
+
2293
+ template <class _Elem, class _Traits>
2294
+ friend basic_ostream<_Elem, _Traits>& operator<<(
2295
+ basic_ostream<_Elem, _Traits>& _Ostr, const uniform_int_distribution& _Dist) {
2296
+ return _Ostr << static_cast<const _Mybase&>(_Dist);
2297
+ }
2298
+
2146
2299
_NODISCARD_FRIEND bool operator==(
2147
2300
const uniform_int_distribution& _Left, const uniform_int_distribution& _Right) noexcept /* strengthened */ {
2148
2301
return _Left.param() == _Right.param();
@@ -2155,6 +2308,7 @@ public:
2155
2308
}
2156
2309
#endif // !_HAS_CXX20
2157
2310
};
2311
+ _STL_RESTORE_DEPRECATED_WARNING
2158
2312
2159
2313
_EXPORT_STD class bernoulli_distribution { // class for bernoulli distribution
2160
2314
public:
@@ -2828,7 +2982,7 @@ private:
2828
2982
};
2829
2983
2830
2984
template <class _Ty = double>
2831
- class uniform_real { // uniform real distribution
2985
+ class _DEPRECATE_TR1_RANDOM uniform_real { // uniform real distribution
2832
2986
public:
2833
2987
using result_type = _Ty;
2834
2988
@@ -2954,8 +3108,9 @@ private:
2954
3108
param_type _Par;
2955
3109
};
2956
3110
3111
+ _STL_DISABLE_DEPRECATED_WARNING
2957
3112
_EXPORT_STD template <class _Ty = double>
2958
- class uniform_real_distribution : public uniform_real<_Ty> { // uniform real distribution
3113
+ class uniform_real_distribution : private uniform_real<_Ty> { // uniform real distribution
2959
3114
public:
2960
3115
_RNG_REQUIRE_REALTYPE(uniform_real_distribution, _Ty);
2961
3116
@@ -2984,6 +3139,54 @@ public:
2984
3139
explicit uniform_real_distribution(const param_type& _Par0) noexcept // strengthened
2985
3140
: _Mybase(_Par0) {}
2986
3141
3142
+ _NODISCARD result_type a() const noexcept /* strengthened */ {
3143
+ return _Mybase::a();
3144
+ }
3145
+
3146
+ _NODISCARD result_type b() const noexcept /* strengthened */ {
3147
+ return _Mybase::b();
3148
+ }
3149
+
3150
+ _NODISCARD param_type param() const noexcept /* strengthened */ {
3151
+ return _Mybase::param();
3152
+ }
3153
+
3154
+ void param(const param_type& _Par0) noexcept /* strengthened */ {
3155
+ _Mybase::param(_Par0);
3156
+ }
3157
+
3158
+ _NODISCARD result_type(min)() const noexcept /* strengthened */ {
3159
+ return (_Mybase::min)();
3160
+ }
3161
+
3162
+ _NODISCARD result_type(max)() const noexcept /* strengthened */ {
3163
+ return (_Mybase::max)();
3164
+ }
3165
+
3166
+ void reset() noexcept /* strengthened */ {}
3167
+
3168
+ template <class _Engine>
3169
+ _NODISCARD result_type operator()(_Engine& _Eng) _DISTRIBUTION_CONST {
3170
+ return _Mybase::operator()(_Eng);
3171
+ }
3172
+
3173
+ template <class _Engine>
3174
+ _NODISCARD result_type operator()(_Engine& _Eng, const param_type& _Par0) _DISTRIBUTION_CONST {
3175
+ return _Mybase::operator()(_Eng, _Par0);
3176
+ }
3177
+
3178
+ template <class _Elem, class _Traits>
3179
+ friend basic_istream<_Elem, _Traits>& operator>>(
3180
+ basic_istream<_Elem, _Traits>& _Istr, uniform_real_distribution& _Dist) {
3181
+ return _Istr >> static_cast<_Mybase&>(_Dist);
3182
+ }
3183
+
3184
+ template <class _Elem, class _Traits>
3185
+ friend basic_ostream<_Elem, _Traits>& operator<<(
3186
+ basic_ostream<_Elem, _Traits>& _Ostr, const uniform_real_distribution& _Dist) {
3187
+ return _Ostr << static_cast<const _Mybase&>(_Dist);
3188
+ }
3189
+
2987
3190
_NODISCARD_FRIEND bool operator==(
2988
3191
const uniform_real_distribution& _Left, const uniform_real_distribution& _Right) noexcept /* strengthened */ {
2989
3192
return _Left.param() == _Right.param();
@@ -2996,6 +3199,7 @@ public:
2996
3199
}
2997
3200
#endif // !_HAS_CXX20
2998
3201
};
3202
+ _STL_RESTORE_DEPRECATED_WARNING
2999
3203
3000
3204
_EXPORT_STD template <class _Ty = double>
3001
3205
class exponential_distribution { // exponential distribution
@@ -4485,7 +4689,7 @@ private:
4485
4689
_Ty _Vx2;
4486
4690
_Ty _Rx0;
4487
4691
_Ty _Rs;
4488
- uniform_real <_Ty> _Dist(-1, 1);
4692
+ uniform_real_distribution <_Ty> _Dist(-1, 1);
4489
4693
for (;;) { // get a point inside unit circle
4490
4694
_Vx1 = _Dist(_Eng);
4491
4695
_Vx2 = _Dist(_Eng);
@@ -5020,7 +5224,7 @@ public:
5020
5224
template <class _Engine>
5021
5225
result_type _Eval(_Engine& _Eng, const param_type& _Par0) _DISTRIBUTION_CONST {
5022
5226
size_t _Px = _Mybase::operator()(_Eng, _Par0);
5023
- uniform_real <_Ty> _Dist(_Par0._Bvec[_Px], _Par0._Bvec[_Px + 1]);
5227
+ uniform_real_distribution <_Ty> _Dist(_Par0._Bvec[_Px], _Par0._Bvec[_Px + 1]);
5024
5228
return _Dist(_Eng);
5025
5229
}
5026
5230
@@ -5247,7 +5451,7 @@ public:
5247
5451
size_t _Px = _Mybase::operator()(_Eng, _Par0);
5248
5452
double _Px0 = _Par0._Pvec[_Px];
5249
5453
double _Px1 = _Par0._Pvec[_Px + 1];
5250
- uniform_real <_Ty> _Dist;
5454
+ uniform_real_distribution <_Ty> _Dist;
5251
5455
result_type _Xx0 = _Dist(_Eng);
5252
5456
5253
5457
if (_Px0 != _Px1) {
0 commit comments