Commit 08a83d5
committed
Allow variant deserialization to make types with private constructors
If a type has a private no-args constructor, but has friended
boost::serialization::access, it can usually be deserialised as normal.
However, it _can't_ be deserialized out of a variant, because the
variant tries to invoke the default constructor.
Fix this by constructing it through boost::serialization::access, which
is designed to model "classes that can't be created with no arguments
except through deserialization"1 parent 8a8c628 commit 08a83d5
4 files changed
Lines changed: 64 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
128 | 134 | | |
129 | | - | |
| 135 | + | |
130 | 136 | | |
131 | 137 | | |
132 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
164 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
165 | 171 | | |
166 | | - | |
| 172 | + | |
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
97 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
98 | 104 | | |
99 | | - | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
60 | 86 | | |
61 | 87 | | |
62 | 88 | | |
| |||
156 | 182 | | |
157 | 183 | | |
158 | 184 | | |
| 185 | + | |
| 186 | + | |
159 | 187 | | |
160 | 188 | | |
161 | 189 | | |
| |||
166 | 194 | | |
167 | 195 | | |
168 | 196 | | |
169 | | - | |
| 197 | + | |
170 | 198 | | |
171 | 199 | | |
172 | | - | |
| 200 | + | |
173 | 201 | | |
174 | 202 | | |
175 | 203 | | |
| |||
180 | 208 | | |
181 | 209 | | |
182 | 210 | | |
183 | | - | |
| 211 | + | |
184 | 212 | | |
185 | 213 | | |
186 | | - | |
| 214 | + | |
187 | 215 | | |
188 | 216 | | |
189 | 217 | | |
| |||
194 | 222 | | |
195 | 223 | | |
196 | 224 | | |
197 | | - | |
| 225 | + | |
198 | 226 | | |
199 | 227 | | |
200 | | - | |
| 228 | + | |
201 | 229 | | |
202 | 230 | | |
203 | 231 | | |
| |||
0 commit comments