Skip to content

Commit

Permalink
Cleaning (#1547)
Browse files Browse the repository at this point in the history
* Cleaning

* Update write.hpp
  • Loading branch information
stephenberry authored Jan 4, 2025
1 parent 4e39cae commit 2d41866
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions include/glaze/json/write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,9 @@ namespace glz
}
}

template <opts Opts, class Key, class Value, is_context Ctx>
GLZ_ALWAYS_INLINE void write_pair_content(const Key& key, Value&& value, Ctx& ctx, auto&& b, auto&& ix)
// "key":value pair output
template <opts Opts, class Key, class Value, is_context Ctx, class B>
GLZ_ALWAYS_INLINE void write_pair_content(const Key& key, Value&& value, Ctx& ctx, B&& b, auto&& ix)
{
if constexpr (str_t<Key> || char_t<Key> || glaze_enum_t<Key> || Opts.quoted_num) {
to<JSON, core_t<Key>>::template op<Opts>(key, ctx, b, ix);
Expand Down Expand Up @@ -1772,7 +1773,6 @@ namespace glz
}
else {
// Null members may be skipped so we cant just write it out for all but the last member
// write_object_entry_separator<Opts, not supports_unchecked_write<val_t>>(ctx, b, ix);
if constexpr (Opts.prettify) {
std::memcpy(&b[ix], ",\n", 2);
ix += 2;
Expand Down Expand Up @@ -1840,7 +1840,7 @@ namespace glz
}
else {
static constexpr auto quoted_key =
join_v<chars<",">, quoted_key_v<key, Opts.prettify>, chars<"null">>;
join_v<chars<",">, quoted_key_v<key>, chars<"null">>;
static constexpr auto n = quoted_key.size();
std::memcpy(&b[ix], quoted_key.data(), n);
ix += n;
Expand All @@ -1854,7 +1854,7 @@ namespace glz
ix += n;
}
else {
static constexpr auto quoted_key = join_v<chars<",">, quoted_key_v<key, Opts.prettify>>;
static constexpr auto quoted_key = join_v<chars<",">, quoted_key_v<key>>;
static constexpr auto n = quoted_key.size();
std::memcpy(&b[ix], quoted_key.data(), n);
ix += n;
Expand Down
2 changes: 1 addition & 1 deletion include/glaze/util/string_literal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace glz
template <const std::string_view&... Strs>
inline constexpr auto join_v = detail::join<Strs...>();

template <const std::string_view& Key, bool Prettify>
template <const std::string_view& Key, bool Prettify = false>
inline constexpr auto quoted_key_v = []() -> std::string_view {
constexpr auto quoted = [] {
constexpr auto N = Key.size();
Expand Down

0 comments on commit 2d41866

Please sign in to comment.