mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Add view support to simdjson_result<array/object>
This commit is contained in:
@@ -177,10 +177,16 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ar
|
||||
#if defined(__cpp_lib_ranges)
|
||||
#include <ranges>
|
||||
|
||||
namespace std::ranges {
|
||||
namespace std {
|
||||
namespace ranges {
|
||||
template<>
|
||||
inline constexpr bool enable_view<simdjson::dom::array> = true;
|
||||
}
|
||||
#if SIMDJSON_EXCEPTIONS
|
||||
template<>
|
||||
inline constexpr bool enable_view<simdjson::simdjson_result<simdjson::dom::array>> = true;
|
||||
#endif // SIMDJSON_EXCEPTIONS
|
||||
} // namespace ranges
|
||||
} // namespace std
|
||||
#endif // defined(__cpp_lib_ranges)
|
||||
|
||||
#endif // SIMDJSON_DOM_ARRAY_H
|
||||
|
||||
@@ -284,13 +284,16 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ob
|
||||
#if defined(__cpp_lib_ranges)
|
||||
#include <ranges>
|
||||
|
||||
namespace std::ranges {
|
||||
namespace std {
|
||||
namespace ranges {
|
||||
template<>
|
||||
inline constexpr bool enable_view<simdjson::dom::object> = true;
|
||||
}
|
||||
|
||||
static_assert(std::ranges::view<simdjson::dom::object>);
|
||||
static_assert(std::ranges::sized_range<simdjson::dom::object>);
|
||||
#endif
|
||||
#if SIMDJSON_EXCEPTIONS
|
||||
template<>
|
||||
inline constexpr bool enable_view<simdjson::simdjson_result<simdjson::dom::object>> = true;
|
||||
#endif // SIMDJSON_EXCEPTIONS
|
||||
} // namespace ranges
|
||||
} // namespace std
|
||||
#endif // defined(__cpp_lib_ranges)
|
||||
|
||||
#endif // SIMDJSON_DOM_OBJECT_H
|
||||
|
||||
@@ -174,6 +174,10 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ar
|
||||
#if defined(__cpp_lib_ranges)
|
||||
static_assert(std::ranges::view<simdjson::dom::array>);
|
||||
static_assert(std::ranges::sized_range<simdjson::dom::array>);
|
||||
#if SIMDJSON_EXCEPTIONS
|
||||
static_assert(std::ranges::view<simdjson::simdjson_result<simdjson::dom::array>>);
|
||||
static_assert(std::ranges::sized_range<simdjson::simdjson_result<simdjson::dom::array>>);
|
||||
#endif // SIMDJSON_EXCEPTIONS
|
||||
#endif // defined(__cpp_lib_ranges)
|
||||
|
||||
#endif // SIMDJSON_INLINE_ARRAY_H
|
||||
|
||||
@@ -272,4 +272,13 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ob
|
||||
|
||||
} // namespace simdjson
|
||||
|
||||
#if defined(__cpp_lib_ranges)
|
||||
static_assert(std::ranges::view<simdjson::dom::object>);
|
||||
static_assert(std::ranges::sized_range<simdjson::dom::object>);
|
||||
#if SIMDJSON_EXCEPTIONS
|
||||
static_assert(std::ranges::view<simdjson::simdjson_result<simdjson::dom::object>>);
|
||||
static_assert(std::ranges::sized_range<simdjson::simdjson_result<simdjson::dom::object>>);
|
||||
#endif // SIMDJSON_EXCEPTIONS
|
||||
#endif // defined(__cpp_lib_ranges)
|
||||
|
||||
#endif // SIMDJSON_INLINE_OBJECT_H
|
||||
|
||||
Reference in New Issue
Block a user