diff --git a/tests/ondemand/ondemand_custom_types_document_tests.cpp b/tests/ondemand/ondemand_custom_types_document_tests.cpp index 15b4da797..23561d30b 100644 --- a/tests/ondemand/ondemand_custom_types_document_tests.cpp +++ b/tests/ondemand/ondemand_custom_types_document_tests.cpp @@ -10,8 +10,9 @@ namespace simdjson { // unique_ptr template -auto tag_invoke(deserialize_tag, std::type_identity>, auto &val) { - return simdjson_result{std::make_unique(val.template get())}; +error_code tag_invoke(deserialize_tag, auto &val, std::unique_ptr& out) { + out = std::make_unique(val.template get()); + return SUCCESS; } } // namespace simdjson @@ -26,13 +27,12 @@ struct Car { int64_t year{}; std::vector tire_pressure{}; - friend simdjson_result tag_invoke(simdjson::deserialize_tag, - std::type_identity, auto &val) { + friend error_code tag_invoke(simdjson::deserialize_tag, + auto &val, Car& car) { simdjson::ondemand::object obj; if (auto const error = val.get_object().get(obj)) { return error; } - Car car{}; // Instead of repeatedly obj["something"], we iterate through the object // which we expect to be faster. for (auto field : obj) { @@ -59,29 +59,14 @@ struct Car { } } } - return car; + return error_code::SUCCESS; } }; -static_assert(simdjson::tag_invocable>, - simdjson::ondemand::value &>, - "It should be invocable"); - -static_assert(simdjson::tag_invocable>, - simdjson::ondemand::document &>, - "Tag_invoke should work with document as well."); - -static_assert(simdjson::tag_invocable>, - simdjson::ondemand::value &>, - "It should be invocable"); - -static_assert(simdjson::tag_invocable>, - simdjson::ondemand::document &>, - "Tag_invoke should work with document as well."); +static_assert(simdjson::deserializable, simdjson::ondemand::value>, "It should be invocable"); +static_assert(simdjson::deserializable, simdjson::ondemand::document>, "Tag_invoke should work with document as well."); +static_assert(simdjson::deserializable, simdjson::ondemand::value>, "It should be invocable"); +static_assert(simdjson::deserializable, simdjson::ondemand::document>, "Tag_invoke should work with document as well."); bool custom_test() { TEST_START();