@@ -218,44 +218,29 @@ namespace glz
218
218
// The decayed type after get_member is called
219
219
template <class T , size_t I>
220
220
using field_t = std::remove_cvref_t <refl_t <T, I>>;
221
-
222
- // MSVC requires this specialization, otherwise it will try to instatiate dead `if constexpr` branches for N == 0
223
- template <opts Opts, class T >
224
- struct object_info ;
225
-
226
- template <opts Opts, class T >
227
- requires (reflect<T>::size == 0 )
228
- struct object_info<Opts, T>
229
- {
230
- static constexpr bool maybe_skipped = false ;
231
- };
232
-
221
+
233
222
template <opts Opts, class T >
234
- requires (reflect<T>::size > 0 )
235
- struct object_info<Opts, T>
236
- {
237
- static constexpr auto N = reflect<T>::size;
238
-
239
- static constexpr bool maybe_skipped = [] {
240
- if constexpr (N > 0 ) {
241
- if constexpr (Opts.skip_null_members ) {
242
- // if any type could be null then we might skip
243
- return []<size_t ... I>(std::index_sequence<I...>) {
244
- return ((detail::always_skipped<field_t <T, I>> || detail::null_t <field_t <T, I>>) || ...);
245
- }(std::make_index_sequence<N>{});
246
- }
247
- else {
248
- // if we have an always_skipped type then we return true
249
- return []<size_t ... I>(std::index_sequence<I...>) {
250
- return ((detail::always_skipped<field_t <T, I>>) || ...);
251
- }(std::make_index_sequence<N>{});
252
- }
223
+ inline constexpr bool maybe_skipped = [] {
224
+ if constexpr (reflect<T>::size > 0 )
225
+ {
226
+ constexpr auto N = reflect<T>::size;
227
+ if constexpr (Opts.skip_null_members ) {
228
+ // if any type could be null then we might skip
229
+ return []<size_t ... I>(std::index_sequence<I...>) {
230
+ return ((detail::always_skipped<field_t <T, I>> || detail::null_t <field_t <T, I>>) || ...);
231
+ }(std::make_index_sequence<N>{});
253
232
}
254
233
else {
255
- return false ;
234
+ // if we have an always_skipped type then we return true
235
+ return []<size_t ... I>(std::index_sequence<I...>) {
236
+ return ((detail::always_skipped<field_t <T, I>>) || ...);
237
+ }(std::make_index_sequence<N>{});
256
238
}
257
- }();
258
- };
239
+ }
240
+ else {
241
+ return false ;
242
+ }
243
+ }();
259
244
}
260
245
261
246
namespace glz ::detail
0 commit comments