diff --git a/stl/inc/random b/stl/inc/random index 377d5cb8095..04a9bf2c628 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -1349,7 +1349,10 @@ public: template class discard_block { // discard_block compound engine public: - using base_type = _Engine; +#if _HAS_TR1_NAMESPACE + using base_type _DEPRECATE_TR1_NAMESPACE = _Engine; // TR1-only typedef +#endif // _HAS_TR1_NAMESPACE + using result_type = typename _Engine::result_type; static constexpr int block_size = _Px; @@ -1359,6 +1362,8 @@ public: explicit discard_block(const _Engine& _Ex) : _Eng(_Ex), _Nx(0) {} + explicit discard_block(_Engine&& _Ex) : _Eng(_STD move(_Ex)), _Nx(0) {} + explicit discard_block(result_type _Seed) : _Eng(_Seed), _Nx(0) {} template = 0> @@ -1380,7 +1385,7 @@ public: _Nx = 0; } - _NODISCARD const base_type& base() const noexcept { + _NODISCARD const _Engine& base() const noexcept { return _Eng; } @@ -1433,20 +1438,21 @@ public: } private: - base_type _Eng; + _Engine _Eng; int _Nx; }; template class _Discard_block_base { // TRANSITION, ABI, should be merged into discard_block_engine public: - using base_type = _Engine; using result_type = typename _Engine::result_type; _Discard_block_base() : _Eng(), _Nx(0) {} explicit _Discard_block_base(const _Engine& _Ex) : _Eng(_Ex), _Nx(0) {} + explicit _Discard_block_base(_Engine&& _Ex) : _Eng(_STD move(_Ex)), _Nx(0) {} + explicit _Discard_block_base(result_type _Seed) : _Eng(_Seed), _Nx(0) {} template = 0> @@ -1468,7 +1474,7 @@ public: _Nx = 0; } - _NODISCARD const base_type& base() const noexcept { + _NODISCARD const _Engine& base() const noexcept { return _Eng; } @@ -1513,7 +1519,7 @@ public: } private: - base_type _Eng; + _Engine _Eng; size_t _Nx; }; @@ -1559,7 +1565,6 @@ public: static_assert( 0 < _Wx && _Wx <= numeric_limits<_UIntType>::digits, "invalid template argument for independent_bits_engine"); - using base_type = _Engine; using result_type = _UIntType; using _Eres = typename _Engine::result_type; @@ -1707,7 +1712,6 @@ class shuffle_order_engine { // shuffle_order_engine compound engine public: static_assert(0 < _Kx, "invalid template argument for shuffle_order_engine"); - using base_type = _Engine; using result_type = typename _Engine::result_type; static constexpr size_t table_size = _Kx; diff --git a/tests/tr1/tests/random1/test.cpp b/tests/tr1/tests/random1/test.cpp index 49c4cfefb9b..90eb1e90e4e 100644 --- a/tests/tr1/tests/random1/test.cpp +++ b/tests/tr1/tests/random1/test.cpp @@ -466,9 +466,11 @@ static void tdiscard() { typedef STD discard_block rng_t; CHECK_INT(rng_t::block_size, 223); CHECK_INT(rng_t::used_block, 24); +#if _HAS_TR1_NAMESPACE CHECK_INT(rng_t::base_type::modulus, 1 << 24); CHECK_INT(rng_t::base_type::long_lag, 24); CHECK_INT(rng_t::base_type::short_lag, 10); +#endif // _HAS_TR1_NAMESPACE bool st = STD is_same::value; CHECK(st);