From 4c34c9623735cdd7d11c333e54ad8723abb1be8b Mon Sep 17 00:00:00 2001 From: Florian Scheibner Date: Thu, 12 Nov 2015 14:27:07 +0100 Subject: Fix getMessages call do not request "result" subitem twice --- include/tgbot/TgTypeParser.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/tgbot') diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index 759dc2f..f7c9791 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -109,6 +109,15 @@ public: return (this->*parseFunc)(treeItem->second); } + template + std::vector> parseJsonAndGetArray(JsonToTgTypeFunc parseFunc, const boost::property_tree::ptree& data) const { + std::vector> result; + for (const std::pair& innerTreeItem : data) { + result.push_back((this->*parseFunc)(innerTreeItem.second)); + } + return result; + } + template std::vector> parseJsonAndGetArray(JsonToTgTypeFunc parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) const { std::vector> result; -- cgit v1.2.3