From Jason Turner

[rand.req]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpgtm91sne/{from.md → to.md} +98 -18
tmp/tmpgtm91sne/{from.md → to.md} RENAMED
@@ -1,11 +1,10 @@
1
  ### Requirements <a id="rand.req">[[rand.req]]</a>
2
 
3
  #### General requirements <a id="rand.req.genl">[[rand.req.genl]]</a>
4
 
5
- Throughout this subclause [[rand]], the effect of instantiating a
6
- template:
7
 
8
  - that has a template type parameter named `Sseq` is undefined unless
9
  the corresponding template argument is cv-unqualified and meets the
10
  requirements of seed sequence [[rand.req.seedseq]].
11
  - that has a template type parameter named `URBG` is undefined unless
@@ -24,18 +23,18 @@ template:
24
  - that has a template type parameter named `UIntType` is undefined
25
  unless the corresponding template argument is cv-unqualified and is
26
  one of `unsigned short`, `unsigned int`, `unsigned long`, or
27
  `unsigned long long`.
28
 
29
- Throughout this subclause [[rand]], phrases of the form “`x` is an
30
- iterator of a specific kind” shall be interpreted as equivalent to the
31
- more formal requirement that “`x` is a value of a type meeting the
32
- requirements of the specified iterator type”.
33
 
34
- Throughout this subclause [[rand]], any constructor that can be called
35
- with a single argument and that meets a requirement specified in this
36
- subclause shall be declared `explicit`.
37
 
38
  #### Seed sequence requirements <a id="rand.req.seedseq">[[rand.req.seedseq]]</a>
39
 
40
  A *seed sequence* is an object that consumes a sequence of
41
  integer-valued data and produces a requested number of unsigned integer
@@ -46,12 +45,12 @@ streams of random variates. This can be useful, for example, in
46
  applications requiring large numbers of random number
47
  engines. — *end note*]
48
 
49
  A class `S` meets the requirements of a seed sequence if the expressions
50
  shown in [[rand.req.seedseq]] are valid and have the indicated
51
- semantics, and if `S` also meets all other requirements of this
52
- subclause [[rand.req.seedseq]]. In that Table and throughout this
53
  subclause:
54
 
55
  - `T` is the type named by `S`’s associated `result_type`;
56
  - `q` is a value of type `S` and `r` is a value of type `S` or
57
  `const S`;
@@ -118,12 +117,12 @@ suitable `operator>>`.
118
 
119
  A class `E` that meets the requirements of a uniform random bit
120
  generator [[rand.req.urng]] also meets the requirements of a *random
121
  number engine* if the expressions shown in [[rand.req.eng]] are valid
122
  and have the indicated semantics, and if `E` also meets all other
123
- requirements of this subclause [[rand.req.eng]]. In that Table and
124
- throughout this subclause:
125
 
126
  - `T` is the type named by `E`’s associated `result_type`;
127
  - `e` is a value of `E`, `v` is an lvalue of `E`, `x` and `y` are
128
  (possibly const) values of `E`;
129
  - `s` is a value of `T`;
@@ -141,10 +140,56 @@ where `charT` and `traits` are constrained according to [[strings]] and
141
  `E` shall meet the *Cpp17CopyConstructible* (
142
  [[cpp17.copyconstructible]]) and *Cpp17CopyAssignable* (
143
  [[cpp17.copyassignable]]) requirements. These operations shall each be
144
  of complexity no worse than 𝑂(\text{size of state}).
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  #### Random number engine adaptor requirements <a id="rand.req.adapt">[[rand.req.adapt]]</a>
147
 
148
  A *random number engine adaptor* (commonly shortened to *adaptor*) `a`
149
  of type `A` is a random number engine that takes values produced by some
150
  other random number engine, and applies an algorithm to those values in
@@ -229,12 +274,12 @@ P(zᵢ |{`p`}), to denote a distribution’s parameters `p` taken as a
229
  whole.
230
 
231
  A class `D` meets the requirements of a *random number distribution* if
232
  the expressions shown in [[rand.req.dist]] are valid and have the
233
  indicated semantics, and if `D` and its associated types also meet all
234
- other requirements of this subclause [[rand.req.dist]]. In that Table
235
- and throughout this subclause,
236
 
237
  - `T` is the type named by `D`’s associated `result_type`;
238
  - `P` is the type named by `D`’s associated `param_type`;
239
  - `d` is a value of `D`, and `x` and `y` are (possibly const) values of
240
  `D`;
@@ -266,13 +311,12 @@ representation is restored into the same or a different object `y` of
266
  the same type using `is >> y`, repeated invocations of `y(g)` shall
267
  produce the same sequence of numbers as would repeated invocations of
268
  `x(g)`.
269
 
270
  It is unspecified whether `D::param_type` is declared as a (nested)
271
- `class` or via a `typedef`. In this subclause [[rand]], declarations of
272
- `D::param_type` are in the form of `typedef`s for convenience of
273
- exposition only.
274
 
275
  `P` shall meet the *Cpp17CopyConstructible* (
276
  [[cpp17.copyconstructible]]), *Cpp17CopyAssignable* (
277
  [[cpp17.copyassignable]]), and *Cpp17EqualityComparable* (
278
  [[cpp17.equalitycomparable]]) requirements.
@@ -289,5 +333,41 @@ the identical name, type, and semantics.
289
 
290
  ``` cpp
291
  using distribution_type = D;
292
  ```
293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ### Requirements <a id="rand.req">[[rand.req]]</a>
2
 
3
  #### General requirements <a id="rand.req.genl">[[rand.req.genl]]</a>
4
 
5
+ Throughout [[rand]], the effect of instantiating a template:
 
6
 
7
  - that has a template type parameter named `Sseq` is undefined unless
8
  the corresponding template argument is cv-unqualified and meets the
9
  requirements of seed sequence [[rand.req.seedseq]].
10
  - that has a template type parameter named `URBG` is undefined unless
 
23
  - that has a template type parameter named `UIntType` is undefined
24
  unless the corresponding template argument is cv-unqualified and is
25
  one of `unsigned short`, `unsigned int`, `unsigned long`, or
26
  `unsigned long long`.
27
 
28
+ Throughout [[rand]], phrases of the form “`x` is an iterator of a
29
+ specific kind” shall be interpreted as equivalent to the more formal
30
+ requirement that “`x` is a value of a type meeting the requirements of
31
+ the specified iterator type”.
32
 
33
+ Throughout [[rand]], any constructor that can be called with a single
34
+ argument and that meets a requirement specified in this subclause shall
35
+ be declared `explicit`.
36
 
37
  #### Seed sequence requirements <a id="rand.req.seedseq">[[rand.req.seedseq]]</a>
38
 
39
  A *seed sequence* is an object that consumes a sequence of
40
  integer-valued data and produces a requested number of unsigned integer
 
45
  applications requiring large numbers of random number
46
  engines. — *end note*]
47
 
48
  A class `S` meets the requirements of a seed sequence if the expressions
49
  shown in [[rand.req.seedseq]] are valid and have the indicated
50
+ semantics, and if `S` also meets all other requirements of
51
+ [[rand.req.seedseq]]. In [[rand.req.seedseq]] and throughout this
52
  subclause:
53
 
54
  - `T` is the type named by `S`’s associated `result_type`;
55
  - `q` is a value of type `S` and `r` is a value of type `S` or
56
  `const S`;
 
117
 
118
  A class `E` that meets the requirements of a uniform random bit
119
  generator [[rand.req.urng]] also meets the requirements of a *random
120
  number engine* if the expressions shown in [[rand.req.eng]] are valid
121
  and have the indicated semantics, and if `E` also meets all other
122
+ requirements of [[rand.req.eng]]. In [[rand.req.eng]] and throughout
123
+ this subclause:
124
 
125
  - `T` is the type named by `E`’s associated `result_type`;
126
  - `e` is a value of `E`, `v` is an lvalue of `E`, `x` and `y` are
127
  (possibly const) values of `E`;
128
  - `s` is a value of `T`;
 
140
  `E` shall meet the *Cpp17CopyConstructible* (
141
  [[cpp17.copyconstructible]]) and *Cpp17CopyAssignable* (
142
  [[cpp17.copyassignable]]) requirements. These operations shall each be
143
  of complexity no worse than 𝑂(\text{size of state}).
144
 
145
+ On hosted implementations, the following expressions are well-formed and
146
+ have the specified semantics.
147
+
148
+ ``` cpp
149
+ os << x
150
+ ```
151
+
152
+ *Effects:* With `os.`*`fmtflags`* set to `ios_base::dec|ios_base::left`
153
+ and the fill character set to the space character, writes to `os` the
154
+ textual representation of `x`’s current state. In the output, adjacent
155
+ numbers are separated by one or more space characters.
156
+
157
+ *Ensures:* The `os.`*`fmtflags`* and fill character are unchanged.
158
+
159
+ *Result:* reference to the type of `os`.
160
+
161
+ *Returns:* `os`.
162
+
163
+ *Complexity:* 𝑂(size of state)
164
+
165
+ ``` cpp
166
+ is >> v
167
+ ```
168
+
169
+ *Preconditions:* `is` provides a textual representation that was
170
+ previously written using an output stream whose imbued locale was the
171
+ same as that of `is`, and whose type’s template specialization arguments
172
+ `charT` and `traits` were respectively the same as those of `is`.
173
+
174
+ *Effects:* With `is.`*`fmtflags`* set to `ios_base::dec`, sets `v`’s
175
+ state as determined by reading its textual representation from `is`. If
176
+ bad input is encountered, ensures that `v`’s state is unchanged by the
177
+ operation and calls `is.setstate(ios_base::failbit)` (which may throw
178
+ `ios_base::failure` [[iostate.flags]]). If a textual representation
179
+ written via `os << x` was subsequently read via `is >> v`, then `x == v`
180
+ provided that there have been no intervening invocations of `x` or of
181
+ `v`.
182
+
183
+ *Ensures:* The `is.`*`fmtflags`* are unchanged.
184
+
185
+ *Result:* reference to the type of `is`.
186
+
187
+ *Returns:* `is`.
188
+
189
+ *Complexity:* 𝑂(size of state)
190
+
191
  #### Random number engine adaptor requirements <a id="rand.req.adapt">[[rand.req.adapt]]</a>
192
 
193
  A *random number engine adaptor* (commonly shortened to *adaptor*) `a`
194
  of type `A` is a random number engine that takes values produced by some
195
  other random number engine, and applies an algorithm to those values in
 
274
  whole.
275
 
276
  A class `D` meets the requirements of a *random number distribution* if
277
  the expressions shown in [[rand.req.dist]] are valid and have the
278
  indicated semantics, and if `D` and its associated types also meet all
279
+ other requirements of [[rand.req.dist]]. In [[rand.req.dist]] and
280
+ throughout this subclause,
281
 
282
  - `T` is the type named by `D`’s associated `result_type`;
283
  - `P` is the type named by `D`’s associated `param_type`;
284
  - `d` is a value of `D`, and `x` and `y` are (possibly const) values of
285
  `D`;
 
311
  the same type using `is >> y`, repeated invocations of `y(g)` shall
312
  produce the same sequence of numbers as would repeated invocations of
313
  `x(g)`.
314
 
315
  It is unspecified whether `D::param_type` is declared as a (nested)
316
+ `class` or via a `typedef`. In [[rand]], declarations of `D::param_type`
317
+ are in the form of `typedef`s for convenience of exposition only.
 
318
 
319
  `P` shall meet the *Cpp17CopyConstructible* (
320
  [[cpp17.copyconstructible]]), *Cpp17CopyAssignable* (
321
  [[cpp17.copyassignable]]), and *Cpp17EqualityComparable* (
322
  [[cpp17.equalitycomparable]]) requirements.
 
333
 
334
  ``` cpp
335
  using distribution_type = D;
336
  ```
337
 
338
+ On hosted implementations, the following expressions are well-formed and
339
+ have the specified semantics.
340
+
341
+ ``` cpp
342
+ os << x
343
+ ```
344
+
345
+ *Effects:* Writes to `os` a textual representation for the parameters
346
+ and the additional internal data of `x`.
347
+
348
+ *Ensures:* The `os.`*`fmtflags`* and fill character are unchanged.
349
+
350
+ *Result:* reference to the type of `os`.
351
+
352
+ *Returns:* `os`.
353
+
354
+ ``` cpp
355
+ is >> d
356
+ ```
357
+
358
+ *Preconditions:* `is` provides a textual representation that was
359
+ previously written using an `os` whose imbued locale and whose type’s
360
+ template specialization arguments `charT` and `traits` were the same as
361
+ those of `is`.
362
+
363
+ *Effects:* Restores from `is` the parameters and additional internal
364
+ data of the lvalue `d`. If bad input is encountered, ensures that `d` is
365
+ unchanged by the operation and calls `is.setstate(ios_base::failbit)`
366
+ (which may throw `ios_base::failure` [[iostate.flags]]).
367
+
368
+ *Ensures:* The `is.`*`fmtflags`* are unchanged.
369
+
370
+ *Result:* reference to the type of `is`.
371
+
372
+ *Returns:* `is`.
373
+