From c6fbf5bf7811289429af14700372db97fd3404fb Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 9 Oct 2024 20:54:24 -0400 Subject: [PATCH] moving SIMDJSON_SUPPORTS_EXTRACT --- benchmark/partial_tweets/simdjson_ondemand.h | 1 - include/simdjson/compiler_check.h | 14 ++++++++++++++ include/simdjson/generic/ondemand/object-inl.h | 2 +- include/simdjson/generic/ondemand/object.h | 5 ++--- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/benchmark/partial_tweets/simdjson_ondemand.h b/benchmark/partial_tweets/simdjson_ondemand.h index f82ba4417..e054b8ad9 100644 --- a/benchmark/partial_tweets/simdjson_ondemand.h +++ b/benchmark/partial_tweets/simdjson_ondemand.h @@ -45,7 +45,6 @@ BENCHMARK_TEMPLATE(partial_tweets, simdjson_ondemand)->UseManualTime(); #if SIMDJSON_SUPPORTS_EXTRACT - using namespace simdjson::ondemand; struct simdjson_ondemand_extract { diff --git a/include/simdjson/compiler_check.h b/include/simdjson/compiler_check.h index 1d0d03d15..598796a91 100644 --- a/include/simdjson/compiler_check.h +++ b/include/simdjson/compiler_check.h @@ -50,4 +50,18 @@ #endif #endif +#ifdef __has_include +#if __has_include() +#include +#endif +#endif + + + +#if defined(__cpp_concepts) +#define SIMDJSON_SUPPORTS_EXTRACT 1 +#else +#define SIMDJSON_SUPPORTS_EXTRACT 0 +#endif + #endif // SIMDJSON_COMPILER_CHECK_H diff --git a/include/simdjson/generic/ondemand/object-inl.h b/include/simdjson/generic/ondemand/object-inl.h index b274e5611..33973a517 100644 --- a/include/simdjson/generic/ondemand/object-inl.h +++ b/include/simdjson/generic/ondemand/object-inl.h @@ -16,7 +16,7 @@ namespace SIMDJSON_IMPLEMENTATION { namespace ondemand { -#ifdef SIMDJSON_SUPPORTS_EXTRACT +#if SIMDJSON_SUPPORTS_EXTRACT #if SIMDJSON_REGULAR_VISUAL_STUDIO diff --git a/include/simdjson/generic/ondemand/object.h b/include/simdjson/generic/ondemand/object.h index f73f581fc..386596ef4 100644 --- a/include/simdjson/generic/ondemand/object.h +++ b/include/simdjson/generic/ondemand/object.h @@ -11,8 +11,7 @@ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { namespace ondemand { -#if defined(__cpp_concepts) && defined(__cpp_consteval) -#define SIMDJSON_SUPPORTS_EXTRACT 1 +#if SIMDJSON_SUPPORTS_EXTRACT template concept endpoint = std::is_invocable_r_v> && @@ -79,7 +78,7 @@ public: /** @overload simdjson_inline simdjson_result find_field(std::string_view key) & noexcept; */ simdjson_inline simdjson_result find_field(std::string_view key) && noexcept; -#ifdef SIMDJSON_SUPPORTS_EXTRACT +#if SIMDJSON_SUPPORTS_EXTRACT /** * Extract all the fields in one go * Funcs are invocables that take a simdjson_result as input.