Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c0010f6

Browse files
committed
Add view support to simdjson_result<array/object>
1 parent 75301e4 commit c0010f6

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

‎include/simdjson/dom/array.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,16 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ar
177177
#if defined(__cpp_lib_ranges)
178178
#include <ranges>
179179

180-
namespace std::ranges {
180+
namespace std {
181+
namespace ranges {
181182
template<>
182183
inline constexpr bool enable_view<simdjson::dom::array> = true;
183-
}
184+
#if SIMDJSON_EXCEPTIONS
185+
template<>
186+
inline constexpr bool enable_view<simdjson::simdjson_result<simdjson::dom::array>> = true;
187+
#endif // SIMDJSON_EXCEPTIONS
188+
} // namespace ranges
189+
} // namespace std
184190
#endif // defined(__cpp_lib_ranges)
185191

186192
#endif // SIMDJSON_DOM_ARRAY_H

‎include/simdjson/dom/object.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,16 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ob
284284
#if defined(__cpp_lib_ranges)
285285
#include <ranges>
286286

287-
namespace std::ranges {
287+
namespace std {
288+
namespace ranges {
288289
template<>
289290
inline constexpr bool enable_view<simdjson::dom::object> = true;
290-
}
291-
292-
static_assert(std::ranges::view<simdjson::dom::object>);
293-
static_assert(std::ranges::sized_range<simdjson::dom::object>);
294-
#endif
291+
#if SIMDJSON_EXCEPTIONS
292+
template<>
293+
inline constexpr bool enable_view<simdjson::simdjson_result<simdjson::dom::object>> = true;
294+
#endif // SIMDJSON_EXCEPTIONS
295+
} // namespace ranges
296+
} // namespace std
297+
#endif // defined(__cpp_lib_ranges)
295298

296299
#endif // SIMDJSON_DOM_OBJECT_H

‎include/simdjson/inline/array.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ar
174174
#if defined(__cpp_lib_ranges)
175175
static_assert(std::ranges::view<simdjson::dom::array>);
176176
static_assert(std::ranges::sized_range<simdjson::dom::array>);
177+
#if SIMDJSON_EXCEPTIONS
178+
static_assert(std::ranges::view<simdjson::simdjson_result<simdjson::dom::array>>);
179+
static_assert(std::ranges::sized_range<simdjson::simdjson_result<simdjson::dom::array>>);
180+
#endif // SIMDJSON_EXCEPTIONS
177181
#endif // defined(__cpp_lib_ranges)
178182

179183
#endif // SIMDJSON_INLINE_ARRAY_H

‎include/simdjson/inline/object.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,13 @@ inline std::ostream& operator<<(std::ostream& out, const simdjson_result<dom::ob
272272

273273
} // namespace simdjson
274274

275+
#if defined(__cpp_lib_ranges)
276+
static_assert(std::ranges::view<simdjson::dom::object>);
277+
static_assert(std::ranges::sized_range<simdjson::dom::object>);
278+
#if SIMDJSON_EXCEPTIONS
279+
static_assert(std::ranges::view<simdjson::simdjson_result<simdjson::dom::object>>);
280+
static_assert(std::ranges::sized_range<simdjson::simdjson_result<simdjson::dom::object>>);
281+
#endif // SIMDJSON_EXCEPTIONS
282+
#endif // defined(__cpp_lib_ranges)
283+
275284
#endif // SIMDJSON_INLINE_OBJECT_H

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /