From Jason Turner

[numeric.requirements]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzwnm4qqn/{from.md → to.md} +30 -18
tmp/tmpzwnm4qqn/{from.md → to.md} RENAMED
@@ -15,35 +15,47 @@ requirements:[^1]
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: Initialization of raw storage using the default
21
- constructor, followed by assignment, is semantically equivalent to
22
- initialization of raw storage using the copy constructor. Destruction
23
- of an object, followed by initialization of its raw storage using the
24
- copy constructor, is semantically equivalent to assignment to the
25
- original object. This rule states that there shall not be any subtle
 
 
 
 
 
 
 
26
  differences in the semantics of initialization versus assignment. This
27
  gives an implementation considerable flexibility in how arrays are
28
- initialized. An implementation is allowed to initialize a `valarray`
29
- by allocating storage using the `new` operator (which implies a call
30
- to the default constructor for each element) and then assigning each
31
- element its value. Or the implementation can allocate raw storage and
32
- use the copy constructor to initialize each element. If the
33
- distinction between initialization and assignment is important for a
34
- class, or if it fails to satisfy any of the other conditions listed
35
- above, the programmer should use `vector` ([[vector]]) instead of
36
- `valarray` for that class;
 
 
 
 
37
  - If `T` is a class, it does not overload unary `operator&`.
38
 
39
  If any operation on `T` throws an exception the effects are undefined.
40
 
41
  In addition, many member and related functions of `valarray<T>` can be
42
  successfully instantiated and will exhibit well-defined behavior if and
43
  only if `T` satisfies additional requirements specified for each such
44
  member or related function.
45
 
46
- It is valid to instantiate `valarray<complex>`, but `operator>()` will
47
- not be successfully instantiated for `valarray<complex>` operands, since
48
- `complex` does not have any ordering operators.
 
49
 
 
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