Add view support to simdjson_result<array/object>
This commit is contained in:
parent
75301e4cf5
commit
c0010f60e6
|
@ -177,10 +177,16 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ar
|
||||||
#if defined(__cpp_lib_ranges)
|
#if defined(__cpp_lib_ranges)
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
namespace std::ranges {
|
namespace std {
|
||||||
|
namespace ranges {
|
||||||
template<>
|
template<>
|
||||||
inline constexpr bool enable_view<simdjson::dom::array> = true;
|
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 // defined(__cpp_lib_ranges)
|
||||||
|
|
||||||
#endif // SIMDJSON_DOM_ARRAY_H
|
#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)
|
#if defined(__cpp_lib_ranges)
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
namespace std::ranges {
|
namespace std {
|
||||||
|
namespace ranges {
|
||||||
template<>
|
template<>
|
||||||
inline constexpr bool enable_view<simdjson::dom::object> = true;
|
inline constexpr bool enable_view<simdjson::dom::object> = true;
|
||||||
}
|
#if SIMDJSON_EXCEPTIONS
|
||||||
|
template<>
|
||||||
static_assert(std::ranges::view<simdjson::dom::object>);
|
inline constexpr bool enable_view<simdjson::simdjson_result<simdjson::dom::object>> = true;
|
||||||
static_assert(std::ranges::sized_range<simdjson::dom::object>);
|
#endif // SIMDJSON_EXCEPTIONS
|
||||||
#endif
|
} // namespace ranges
|
||||||
|
} // namespace std
|
||||||
|
#endif // defined(__cpp_lib_ranges)
|
||||||
|
|
||||||
#endif // SIMDJSON_DOM_OBJECT_H
|
#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)
|
#if defined(__cpp_lib_ranges)
|
||||||
static_assert(std::ranges::view<simdjson::dom::array>);
|
static_assert(std::ranges::view<simdjson::dom::array>);
|
||||||
static_assert(std::ranges::sized_range<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 // defined(__cpp_lib_ranges)
|
||||||
|
|
||||||
#endif // SIMDJSON_INLINE_ARRAY_H
|
#endif // SIMDJSON_INLINE_ARRAY_H
|
||||||
|
|
|
@ -272,4 +272,13 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ob
|
||||||
|
|
||||||
} // namespace simdjson
|
} // 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
|
#endif // SIMDJSON_INLINE_OBJECT_H
|
||||||
|
|
Loading…
Reference in New Issue