From 38002d2e42edd220b1379fcc7e3985bd5d599d95 Mon Sep 17 00:00:00 2001 From: Tindy X <49061470+tindy2013@users.noreply.github.com> Date: Sat, 25 Jul 2020 12:49:17 -0700 Subject: [PATCH] Using another method for exists call (#152) --- include/inja/renderer.hpp | 2 +- single_include/inja/inja.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/inja/renderer.hpp b/include/inja/renderer.hpp index 9a4dae0..603c45d 100644 --- a/include/inja/renderer.hpp +++ b/include/inja/renderer.hpp @@ -334,7 +334,7 @@ class Renderer : public NodeVisitor { } break; case Op::Exists: { auto &&name = get_arguments<1>(node)[0]->get_ref(); - result_ptr = std::make_shared(json_input->find(name) != json_input->end()); + result_ptr = std::make_shared(json_input->contains(json::json_pointer(JsonNode(name, 0).ptr))); json_tmp_stack.push_back(result_ptr); json_eval_stack.push(result_ptr.get()); } break; diff --git a/single_include/inja/inja.hpp b/single_include/inja/inja.hpp index 755827b..39f5a59 100644 --- a/single_include/inja/inja.hpp +++ b/single_include/inja/inja.hpp @@ -3576,7 +3576,7 @@ class Renderer : public NodeVisitor { } break; case Op::Exists: { auto &&name = get_arguments<1>(node)[0]->get_ref(); - result_ptr = std::make_shared(json_input->find(name) != json_input->end()); + result_ptr = std::make_shared(json_input->contains(json::json_pointer(JsonNode(name, 0).ptr))); json_tmp_stack.push_back(result_ptr); json_eval_stack.push(result_ptr.get()); } break;