Skip to content

Commit 7a2a229

Browse files
committed
Updates sum_types
1 parent 12bd995 commit 7a2a229

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

docs/sum_types.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,6 @@ But `union` is _forgetful_ in the sense that it does not remember whether
112112
it holds `A` or `B`. The information is contained in the union; but
113113
without outside help, it cannot be recovered.
114114

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-
126115
Since the C++ union is forgetful, and additional code would be
127116
required to make it an actual sum type, it is not being considered a
128117
proper implementation of a sum type. The C++ standard library has an

0 commit comments

Comments
 (0)