@@ -1110,53 +1110,25 @@ namespace glz
1110
1110
[[maybe_unused]] bool starting = write_first_entry (it);
1111
1111
++it;
1112
1112
for (const auto end = std::end (value); it != end; ++it) {
1113
- // I couldn't find an easy way around this code duplication
1114
- // Ranges need to be decomposed with const auto& [...],
1115
- // but we don't want to const qualify our maps for the sake of reflection writing
1116
- // we need to be able to populate the tuple of pointers when writing with reflection
1117
- if constexpr (requires {
1118
- it->first ;
1119
- it->second ;
1120
- }) {
1121
- if (skip_member<Opts>(it->second )) {
1122
- continue ;
1123
- }
1113
+ auto && [key, entry_val] = *it;
1114
+ if (skip_member<Opts>(entry_val)) {
1115
+ continue ;
1116
+ }
1124
1117
1125
- // When Opts.skip_null_members, *any* entry may be skipped, meaning separator dumping must be
1126
- // conditional for every entry. Avoid this branch when not skipping null members.
1127
- // Alternatively, write separator after each entry except last but then branch is permanent
1128
- if constexpr (Opts.skip_null_members ) {
1129
- if (!starting) {
1130
- write_object_entry_separator<Opts>(ctx, b, ix);
1131
- }
1132
- }
1133
- else {
1118
+ // When Opts.skip_null_members, *any* entry may be skipped, meaning separator dumping must be
1119
+ // conditional for every entry. Avoid this branch when not skipping null members.
1120
+ // Alternatively, write separator after each entry except last but then branch is permanent
1121
+ if constexpr (Opts.skip_null_members ) {
1122
+ if (!starting) {
1134
1123
write_object_entry_separator<Opts>(ctx, b, ix);
1135
1124
}
1136
-
1137
- write_pair_content<Opts>(it->first , it->second , ctx, b, ix);
1138
1125
}
1139
1126
else {
1140
- const auto & [key, entry_val] = *it;
1141
- if (skip_member<Opts>(entry_val)) {
1142
- continue ;
1143
- }
1144
-
1145
- // When Opts.skip_null_members, *any* entry may be skipped, meaning separator dumping must be
1146
- // conditional for every entry. Avoid this branch when not skipping null members.
1147
- // Alternatively, write separator after each entry except last but then branch is permanent
1148
- if constexpr (Opts.skip_null_members ) {
1149
- if (!starting) {
1150
- write_object_entry_separator<Opts>(ctx, b, ix);
1151
- }
1152
- }
1153
- else {
1154
- write_object_entry_separator<Opts>(ctx, b, ix);
1155
- }
1156
-
1157
- write_pair_content<Opts>(key, entry_val, ctx, b, ix);
1127
+ write_object_entry_separator<Opts>(ctx, b, ix);
1158
1128
}
1159
1129
1130
+ write_pair_content<Opts>(key, entry_val, ctx, b, ix);
1131
+
1160
1132
starting = false ;
1161
1133
}
1162
1134
}
@@ -1178,18 +1150,9 @@ namespace glz
1178
1150
write_first_entry (it);
1179
1151
++it;
1180
1152
for (const auto end = std::end (value); it != end; ++it) {
1181
- if constexpr (requires {
1182
- it->first ;
1183
- it->second ;
1184
- }) {
1185
- write_object_entry_separator<Opts>(ctx, b, ix);
1186
- write_pair_content<Opts>(it->first , it->second , ctx, b, ix);
1187
- }
1188
- else {
1189
- const auto & [key, entry_val] = *it;
1190
- write_object_entry_separator<Opts>(ctx, b, ix);
1191
- write_pair_content<Opts>(key, entry_val, ctx, b, ix);
1192
- }
1153
+ auto && [key, entry_val] = *it;
1154
+ write_object_entry_separator<Opts>(ctx, b, ix);
1155
+ write_pair_content<Opts>(key, entry_val, ctx, b, ix);
1193
1156
}
1194
1157
}
1195
1158
}
0 commit comments