@@ -169,6 +169,41 @@ void load_minimal( Archive const &, Issue79Struct & val, std::int32_t const & xx
169
169
val.x = xx;
170
170
}
171
171
172
+ struct Issue79StructInternal
173
+ {
174
+ Issue79StructInternal () = default ;
175
+ Issue79StructInternal ( std::int32_t xx ) : x(xx) {}
176
+ std::int32_t x;
177
+
178
+ template <class Archive , cereal::traits::DisableIf<std::is_same<Archive, cereal::BinaryOutputArchive>::value ||
179
+ std::is_same<Archive, cereal::PortableBinaryOutputArchive>::value> = cereal::traits::sfinae>
180
+ std::string save_minimal ( Archive const & ) const
181
+ {
182
+ return std::to_string ( x );
183
+ }
184
+
185
+ template <class Archive , cereal::traits::DisableIf<std::is_same<Archive, cereal::BinaryInputArchive>::value ||
186
+ std::is_same<Archive, cereal::PortableBinaryInputArchive>::value> = cereal::traits::sfinae>
187
+ void load_minimal ( Archive const &, std::string const & str )
188
+ {
189
+ x = std::stoi ( str );
190
+ }
191
+
192
+ template <class Archive , cereal::traits::EnableIf<std::is_same<Archive, cereal::BinaryOutputArchive>::value ||
193
+ std::is_same<Archive, cereal::PortableBinaryOutputArchive>::value> = cereal::traits::sfinae>
194
+ std::int32_t save_minimal ( Archive const & ) const
195
+ {
196
+ return x;
197
+ }
198
+
199
+ template <class Archive , cereal::traits::EnableIf<std::is_same<Archive, cereal::BinaryInputArchive>::value ||
200
+ std::is_same<Archive, cereal::PortableBinaryInputArchive>::value> = cereal::traits::sfinae>
201
+ void load_minimal ( Archive const &, std::int32_t const & xx )
202
+ {
203
+ x = xx;
204
+ }
205
+ };
206
+
172
207
template <class IArchive , class OArchive >
173
208
void test_structs_minimal ()
174
209
{
@@ -181,22 +216,26 @@ void test_structs_minimal()
181
216
random_value<std::uint32_t >(gen), random_value<uint8_t >(gen) % 2 ? true : false };
182
217
183
218
Issue79Struct o_struct2 = { random_value<std::int32_t >(gen) };
219
+ Issue79StructInternal o_struct3 = { random_value<std::int32_t >(gen) };
184
220
185
221
std::ostringstream os;
186
222
{
187
223
OArchive oar (os);
188
224
oar ( o_struct );
189
225
oar ( o_struct2 );
226
+ oar ( o_struct3 );
190
227
}
191
228
192
229
decltype (o_struct) i_struct;
193
230
decltype (o_struct2) i_struct2;
231
+ decltype (o_struct3) i_struct3;
194
232
195
233
std::istringstream is (os.str ());
196
234
{
197
235
IArchive iar (is);
198
236
iar ( i_struct );
199
237
iar ( i_struct2 );
238
+ iar ( i_struct3 );
200
239
}
201
240
202
241
BOOST_CHECK (o_struct.mm .x == i_struct.mm .x );
@@ -206,6 +245,8 @@ void test_structs_minimal()
206
245
BOOST_CHECK (o_struct.nmmv .x == i_struct.nmmv .x );
207
246
208
247
BOOST_CHECK (o_struct2.x == i_struct2.x );
248
+
249
+ BOOST_CHECK (o_struct3.x == i_struct3.x );
209
250
}
210
251
}
211
252
0 commit comments