We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12bd995 commit 7a2a229Copy full SHA for 7a2a229
docs/sum_types.md
@@ -112,17 +112,6 @@ But `union` is _forgetful_ in the sense that it does not remember whether
112
it holds `A` or `B`. The information is contained in the union; but
113
without outside help, it cannot be recovered.
114
115
-```c++
116
-enum class D {_a, _b} d;
117
-union S {A a; B b;};
118
-S s = /* an A or a B */; // these two assignments
119
-D d = /* _a or _b */; // should be atomic
120
-switch (d) {
121
- case D::_a: return s.a;
122
- case D::_b: return s.b;
123
-}
124
-```
125
-
126
Since the C++ union is forgetful, and additional code would be
127
required to make it an actual sum type, it is not being considered a
128
proper implementation of a sum type. The C++ standard library has an
0 commit comments