File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =' 1.0' encoding =' utf-8' standalone =' no' ?>
2
+ <!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3
+
4
+ <issue num =" 4265" status =" New" >
5
+ <title >`std::midpoint` should not accept `const bool`</title >
6
+ <section ><sref ref =" [numeric.ops.midpoint]" /></section >
7
+ <submitter >Jan Schultke</submitter >
8
+ <date >21 May 2025</date >
9
+ <priority >99</priority >
10
+
11
+ <discussion >
12
+ <p >
13
+ The constraints of the first overload of `std::midpoint` are as follows:
14
+ </p >
15
+ <blockquote >
16
+ <pre >
17
+ template< class T>
18
+ constexpr T midpoint(T a, T b) noexcept;
19
+ </pre >
20
+ <blockquote >
21
+ <p >
22
+ -1- <i >Constraints</i >: `T` is an arithmetic type other than `bool`.
23
+ </p >
24
+ </blockquote >
25
+ </blockquote >
26
+ <p >
27
+ It does not appear intentional that `const bool` is supported considering that
28
+ <sref ref =" [numeric.ops.gcd]" /> excludes <i >cv</i > `bool`.
29
+ <p />
30
+ More generally, it is questionable that <i >cv</i >-qualified arithmetic types aren't
31
+ excluded in general, considering that <sref ref =" [numeric.sat]" /> excludes them with
32
+ the "signed or unsigned integer type" constraint. However, tightening the constraints
33
+ for these other functions seems evolutionary, not like fixing an obvious oversight,
34
+ and so it likely requires a separate issue.
35
+ </p >
36
+
37
+ </discussion >
38
+
39
+ <resolution >
40
+ <p >
41
+ This wording is relative to <paper num =" N5008" />.
42
+ </p >
43
+ <ol >
44
+
45
+ <li ><p >Modify <sref ref =" [numeric.ops.midpoint]" /> as indicated:</p >
46
+
47
+ <blockquote >
48
+ <pre >
49
+ template< class T>
50
+ constexpr T midpoint(T a, T b) noexcept;
51
+ </pre >
52
+ <blockquote >
53
+ <p >
54
+ -1- <i >Constraints</i >: `T` is an arithmetic type other than <ins ><i >cv</i ></ins > `bool`.
55
+ </p >
56
+ </blockquote >
57
+ </blockquote >
58
+
59
+ </li >
60
+
61
+ </ol >
62
+
63
+ </resolution >
64
+
65
+ </issue >
You can’t perform that action at this time.
0 commit comments