Make it possible to provide custom serializers for range types ( (#2550)

If you provide a custom serializer for range types it is currently never used due to the requires clause for string_builder::append with ranges is overly broad
This commit is contained in:
Jake S. Del Mastro
2025-12-12 17:50:52 -05:00
committed by GitHub
parent aa7489060a
commit 4e9ff03af5
2 changed files with 3 additions and 3 deletions
@@ -534,7 +534,7 @@ simdjson_inline void string_builder::append(const T &value) {
#if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS
// Support for range-based appending (std::ranges::view, etc.)
template <std::ranges::range R>
requires(!std::is_convertible<R, std::string_view>::value)
requires(!std::is_convertible<R, std::string_view>::value && !require_custom_serialization<R>)
simdjson_inline void string_builder::append(const R &range) noexcept {
auto it = std::ranges::begin(range);
auto end = std::ranges::end(range);
@@ -176,7 +176,7 @@ public:
#if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS
// Support for range-based appending (std::ranges::view, etc.)
template <std::ranges::range R>
requires (!std::is_convertible<R, std::string_view>::value)
requires (!std::is_convertible<R, std::string_view>::value && !require_custom_serialization<R>)
simdjson_inline void append(const R &range) noexcept;
#endif
/**
@@ -301,4 +301,4 @@ simdjson_warn_unused simdjson_error to_json(const Z &z, std::string &s, size_t i
} // namespace simdjson
#endif // SIMDJSON_GENERIC_STRING_BUILDER_H
#endif // SIMDJSON_GENERIC_STRING_BUILDER_H