#ifndef SIMDJSON_STD_STD_H #define SIMDJSON_STD_STD_H #ifndef SIMDJSON_SUPPORTS_DESERIALIZATION #include "simdjson/generic/ondemand/deserialize.h" #endif #ifdef SIMDJSON_SUPPORTS_DESERIALIZATION #include #include namespace simdjson { template error_code tag_invoke(deserialize_tag, auto &val, T &out) noexcept { using limits = std::numeric_limits; uint64_t x; SIMDJSON_TRY(val.get_uint64().get(x)); if (x > limits::max()) { return NUMBER_OUT_OF_RANGE; } out = static_cast(x); return SUCCESS; } template error_code tag_invoke(deserialize_tag, auto &val, T &out) noexcept { double x; SIMDJSON_TRY(val.get_double().get(x)); out = static_cast(x); return SUCCESS; } template error_code tag_invoke(deserialize_tag, auto &val, T &out) noexcept { using limits = std::numeric_limits; int64_t x; SIMDJSON_TRY(val.get_int64().get(x)); if (x > limits::max() || x < limits::min()) { return NUMBER_OUT_OF_RANGE; } out = static_cast(x); return SUCCESS; } } // namespace simdjson #endif // SIMDJSON_SUPPORTS_DESERIALIZATION #endif // SIMDJSON_STD_STD_H