From Jason Turner

[numeric.requirements]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1ix870qw/{from.md → to.md} +8 -47
tmp/tmp1ix870qw/{from.md → to.md} RENAMED
@@ -1,61 +1,22 @@
1
  ## Numeric type requirements <a id="numeric.requirements">[[numeric.requirements]]</a>
2
 
3
  The `complex` and `valarray` components are parameterized by the type of
4
  information they contain and manipulate. A C++ program shall instantiate
5
- these components only with a type `T` that satisfies the following
6
- requirements:[^1]
7
-
8
- - `T` is not an abstract class (it has no pure virtual member
9
- functions);
10
- - `T` is not a reference type;
11
- - `T` is not cv-qualified;
12
- - If `T` is a class, it has a public default constructor;
13
- - If `T` is a class, it has a public copy constructor with the signature
14
- `T::T(const T&)`
15
- - If `T` is a class, it has a public destructor;
16
- - If `T` is a class, it has a public assignment operator whose signature
17
- is either `T& T::operator=(const T&)` or `T& T::operator=(T)`
18
- - If `T` is a class, its assignment operator, copy and default
19
- constructors, and destructor shall correspond to each other in the
20
- following sense:
21
- - Initialization of raw storage using the copy constructor on the
22
- value of `T()`, however obtained, is semantically equivalent to
23
- value-initialization of the same raw storage.
24
- - Initialization of raw storage using the default constructor,
25
- followed by assignment, is semantically equivalent to initialization
26
- of raw storage using the copy constructor.
27
- - Destruction of an object, followed by initialization of its raw
28
- storage using the copy constructor, is semantically equivalent to
29
- assignment to the original object.
30
-
31
- \[*Note 1*:
32
- This rule states, in part, that there shall not be any subtle
33
- differences in the semantics of initialization versus assignment. This
34
- gives an implementation considerable flexibility in how arrays are
35
- initialized.
36
- \[*Example 1*:
37
- An implementation is allowed to initialize a `valarray` by allocating
38
- storage using the `new` operator (which implies a call to the default
39
- constructor for each element) and then assigning each element its
40
- value. Or the implementation can allocate raw storage and use the copy
41
- constructor to initialize each element.
42
- — *end example*]
43
- If the distinction between initialization and assignment is important
44
- for a class, or if it fails to satisfy any of the other conditions
45
- listed above, the programmer should use `vector` ([[vector]]) instead
46
- of `valarray` for that class.
47
- — *end note*]
48
- - If `T` is a class, it does not overload unary `operator&`.
49
 
50
  If any operation on `T` throws an exception the effects are undefined.
51
 
52
  In addition, many member and related functions of `valarray<T>` can be
53
  successfully instantiated and will exhibit well-defined behavior if and
54
- only if `T` satisfies additional requirements specified for each such
55
- member or related function.
56
 
57
- [*Example 2*: It is valid to instantiate `valarray<complex>`, but
58
  `operator>()` will not be successfully instantiated for
59
  `valarray<complex>` operands, since `complex` does not have any ordering
60
  operators. — *end example*]
61
 
 
1
  ## Numeric type requirements <a id="numeric.requirements">[[numeric.requirements]]</a>
2
 
3
  The `complex` and `valarray` components are parameterized by the type of
4
  information they contain and manipulate. A C++ program shall instantiate
5
+ these components only with a numeric type. A *numeric type* is a
6
+ cv-unqualified object type `T` that meets the
7
+ *Cpp17DefaultConstructible*, *Cpp17CopyConstructible*,
8
+ *Cpp17CopyAssignable*, and *Cpp17Destructible* requirements
9
+ [[utility.arg.requirements]]. [^1]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  If any operation on `T` throws an exception the effects are undefined.
12
 
13
  In addition, many member and related functions of `valarray<T>` can be
14
  successfully instantiated and will exhibit well-defined behavior if and
15
+ only if `T` meets additional requirements specified for each such member
16
+ or related function.
17
 
18
+ [*Example 1*: It is valid to instantiate `valarray<complex>`, but
19
  `operator>()` will not be successfully instantiated for
20
  `valarray<complex>` operands, since `complex` does not have any ordering
21
  operators. — *end example*]
22