tmp/tmpn_qy9c6o/{from.md → to.md}
RENAMED
|
@@ -1,33 +1,33 @@
|
|
| 1 |
### Random number engine adaptor class templates <a id="rand.adapt">[[rand.adapt]]</a>
|
| 2 |
|
| 3 |
-
####
|
| 4 |
|
| 5 |
-
Each type instantiated from a class template specified in
|
| 6 |
-
|
| 7 |
-
|
| 8 |
|
| 9 |
Except where specified otherwise, the complexity of each function
|
| 10 |
-
specified in
|
| 11 |
|
| 12 |
-
Except where specified otherwise, no function described in
|
| 13 |
-
|
| 14 |
|
| 15 |
-
Every function described in
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
-
Descriptions are provided in
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
|
| 27 |
-
Each template specified in
|
| 28 |
-
|
| 29 |
parameter(s), to hold. A program instantiating any of these templates is
|
| 30 |
ill-formed if any such required relationship fails to hold.
|
| 31 |
|
| 32 |
#### Class template `discard_block_engine` <a id="rand.adapt.disc">[[rand.adapt.disc]]</a>
|
| 33 |
|
|
@@ -50,11 +50,11 @@ invocation of `e()` while advancing `e`’s state as described above.
|
|
| 50 |
namespace std {
|
| 51 |
template<class Engine, size_t p, size_t r>
|
| 52 |
class discard_block_engine {
|
| 53 |
public:
|
| 54 |
// types
|
| 55 |
-
using result_type =
|
| 56 |
|
| 57 |
// engine characteristics
|
| 58 |
static constexpr size_t block_size = p;
|
| 59 |
static constexpr size_t used_block = r;
|
| 60 |
static constexpr result_type min() { return Engine::min(); }
|
|
@@ -81,14 +81,14 @@ namespace std {
|
|
| 81 |
const Engine& base() const noexcept { return e; }
|
| 82 |
|
| 83 |
// inserters and extractors
|
| 84 |
template<class charT, class traits>
|
| 85 |
friend basic_ostream<charT, traits>&
|
| 86 |
-
operator<<(basic_ostream<charT, traits>& os, const discard_block_engine& x);
|
| 87 |
template<class charT, class traits>
|
| 88 |
friend basic_istream<charT, traits>&
|
| 89 |
-
operator>>(basic_istream<charT, traits>& is, discard_block_engine& x);
|
| 90 |
|
| 91 |
private:
|
| 92 |
Engine e; // exposition only
|
| 93 |
size_t n; // exposition only
|
| 94 |
};
|
|
@@ -144,10 +144,11 @@ for (k = n₀; k \neq n; k += 1) {
|
|
| 144 |
S = 2^{w₀ + 1} \cdot S + u \bmod 2^{w₀ + 1};
|
| 145 |
}
|
| 146 |
```
|
| 147 |
|
| 148 |
``` cpp
|
|
|
|
| 149 |
template<class Engine, size_t w, class UIntType>
|
| 150 |
class independent_bits_engine {
|
| 151 |
public:
|
| 152 |
// types
|
| 153 |
using result_type = UIntType;
|
|
@@ -177,18 +178,19 @@ template<class Engine, size_t w, class UIntType>
|
|
| 177 |
const Engine& base() const noexcept { return e; }
|
| 178 |
|
| 179 |
// inserters and extractors
|
| 180 |
template<class charT, class traits>
|
| 181 |
friend basic_ostream<charT, traits>&
|
| 182 |
-
operator<<(basic_ostream<charT, traits>& os, const independent_bits_engine& x);
|
| 183 |
template<class charT, class traits>
|
| 184 |
friend basic_istream<charT, traits>&
|
| 185 |
-
operator>>(basic_istream<charT, traits>& is, independent_bits_engine& x);
|
| 186 |
|
| 187 |
private:
|
| 188 |
Engine e; // exposition only
|
| 189 |
};
|
|
|
|
| 190 |
```
|
| 191 |
|
| 192 |
The following relations shall hold: `0 < w` and
|
| 193 |
`w <= numeric_limits<result_type>::digits`.
|
| 194 |
|
|
@@ -220,11 +222,11 @@ advancing `e`’s state as described above.
|
|
| 220 |
namespace std {
|
| 221 |
template<class Engine, size_t k>
|
| 222 |
class shuffle_order_engine {
|
| 223 |
public:
|
| 224 |
// types
|
| 225 |
-
using result_type =
|
| 226 |
|
| 227 |
// engine characteristics
|
| 228 |
static constexpr size_t table_size = k;
|
| 229 |
static constexpr result_type min() { return Engine::min(); }
|
| 230 |
static constexpr result_type max() { return Engine::max(); }
|
|
|
|
| 1 |
### Random number engine adaptor class templates <a id="rand.adapt">[[rand.adapt]]</a>
|
| 2 |
|
| 3 |
+
#### General <a id="rand.adapt.general">[[rand.adapt.general]]</a>
|
| 4 |
|
| 5 |
+
Each type instantiated from a class template specified in [[rand.adapt]]
|
| 6 |
+
meets the requirements of a random number engine adaptor
|
| 7 |
+
[[rand.req.adapt]] type.
|
| 8 |
|
| 9 |
Except where specified otherwise, the complexity of each function
|
| 10 |
+
specified in [[rand.adapt]] is constant.
|
| 11 |
|
| 12 |
+
Except where specified otherwise, no function described in
|
| 13 |
+
[[rand.adapt]] throws an exception.
|
| 14 |
|
| 15 |
+
Every function described in [[rand.adapt]] that has a function parameter
|
| 16 |
+
`q` of type `Sseq&` for a template type parameter named `Sseq` that is
|
| 17 |
+
different from type `seed_seq` throws what and when the invocation of
|
| 18 |
+
`q.generate` throws.
|
| 19 |
|
| 20 |
+
Descriptions are provided in [[rand.adapt]] only for adaptor operations
|
| 21 |
+
that are not described in subclause [[rand.req.adapt]] or for
|
| 22 |
+
operations where there is additional semantic information. In
|
| 23 |
+
particular, declarations for copy constructors, for copy assignment
|
| 24 |
+
operators, for streaming operators, and for equality and inequality
|
| 25 |
+
operators are not shown in the synopses.
|
| 26 |
|
| 27 |
+
Each template specified in [[rand.adapt]] requires one or more
|
| 28 |
+
relationships, involving the value(s) of its constant template
|
| 29 |
parameter(s), to hold. A program instantiating any of these templates is
|
| 30 |
ill-formed if any such required relationship fails to hold.
|
| 31 |
|
| 32 |
#### Class template `discard_block_engine` <a id="rand.adapt.disc">[[rand.adapt.disc]]</a>
|
| 33 |
|
|
|
|
| 50 |
namespace std {
|
| 51 |
template<class Engine, size_t p, size_t r>
|
| 52 |
class discard_block_engine {
|
| 53 |
public:
|
| 54 |
// types
|
| 55 |
+
using result_type = Engine::result_type;
|
| 56 |
|
| 57 |
// engine characteristics
|
| 58 |
static constexpr size_t block_size = p;
|
| 59 |
static constexpr size_t used_block = r;
|
| 60 |
static constexpr result_type min() { return Engine::min(); }
|
|
|
|
| 81 |
const Engine& base() const noexcept { return e; }
|
| 82 |
|
| 83 |
// inserters and extractors
|
| 84 |
template<class charT, class traits>
|
| 85 |
friend basic_ostream<charT, traits>&
|
| 86 |
+
operator<<(basic_ostream<charT, traits>& os, const discard_block_engine& x); // hosted
|
| 87 |
template<class charT, class traits>
|
| 88 |
friend basic_istream<charT, traits>&
|
| 89 |
+
operator>>(basic_istream<charT, traits>& is, discard_block_engine& x); // hosted
|
| 90 |
|
| 91 |
private:
|
| 92 |
Engine e; // exposition only
|
| 93 |
size_t n; // exposition only
|
| 94 |
};
|
|
|
|
| 144 |
S = 2^{w₀ + 1} \cdot S + u \bmod 2^{w₀ + 1};
|
| 145 |
}
|
| 146 |
```
|
| 147 |
|
| 148 |
``` cpp
|
| 149 |
+
namespace std {
|
| 150 |
template<class Engine, size_t w, class UIntType>
|
| 151 |
class independent_bits_engine {
|
| 152 |
public:
|
| 153 |
// types
|
| 154 |
using result_type = UIntType;
|
|
|
|
| 178 |
const Engine& base() const noexcept { return e; }
|
| 179 |
|
| 180 |
// inserters and extractors
|
| 181 |
template<class charT, class traits>
|
| 182 |
friend basic_ostream<charT, traits>&
|
| 183 |
+
operator<<(basic_ostream<charT, traits>& os, const independent_bits_engine& x); // hosted
|
| 184 |
template<class charT, class traits>
|
| 185 |
friend basic_istream<charT, traits>&
|
| 186 |
+
operator>>(basic_istream<charT, traits>& is, independent_bits_engine& x); // hosted
|
| 187 |
|
| 188 |
private:
|
| 189 |
Engine e; // exposition only
|
| 190 |
};
|
| 191 |
+
}
|
| 192 |
```
|
| 193 |
|
| 194 |
The following relations shall hold: `0 < w` and
|
| 195 |
`w <= numeric_limits<result_type>::digits`.
|
| 196 |
|
|
|
|
| 222 |
namespace std {
|
| 223 |
template<class Engine, size_t k>
|
| 224 |
class shuffle_order_engine {
|
| 225 |
public:
|
| 226 |
// types
|
| 227 |
+
using result_type = Engine::result_type;
|
| 228 |
|
| 229 |
// engine characteristics
|
| 230 |
static constexpr size_t table_size = k;
|
| 231 |
static constexpr result_type min() { return Engine::min(); }
|
| 232 |
static constexpr result_type max() { return Engine::max(); }
|