From 00049c20d0bd79ef4d6be42d0d6d76a0c1900437 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Wed, 11 Mar 2020 07:41:53 +0100 Subject: [PATCH 1/2] Rename argument array_index to array_indx in json_pointer methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes gcc48 warning: declaration of ‘array_index’ shadows a member of 'this' [-Wshadow] --- include/nlohmann/detail/json_pointer.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index 87af3423..9a29cd4c 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp @@ -126,8 +126,8 @@ class json_pointer /*! @brief append an array index at the end of this JSON pointer - @param[in] array_index array index to append - @return JSON pointer with @a array_index appended + @param[in] array_indx array index to append + @return JSON pointer with @a array_indx appended @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add} @@ -139,9 +139,9 @@ class json_pointer @since version 3.6.0 */ - json_pointer& operator/=(std::size_t array_index) + json_pointer& operator/=(std::size_t array_indx) { - return *this /= std::to_string(array_index); + return *this /= std::to_string(array_indx); } /*! @@ -189,8 +189,8 @@ class json_pointer @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer @param[in] ptr JSON pointer - @param[in] array_index array index - @return a new JSON pointer with @a array_index appended to @a ptr + @param[in] array_indx array index + @return a new JSON pointer with @a array_indx appended to @a ptr @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary} @@ -200,9 +200,9 @@ class json_pointer @since version 3.6.0 */ - friend json_pointer operator/(const json_pointer& ptr, std::size_t array_index) + friend json_pointer operator/(const json_pointer& ptr, std::size_t array_indx) { - return json_pointer(ptr) /= array_index; + return json_pointer(ptr) /= array_indx; } /*! From 78e911b8c3ebce27e177693934f1947f0fe6ccaa Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Thu, 19 Mar 2020 11:52:40 +0100 Subject: [PATCH 2/2] Use array_idx as methods args Avoid mix-up with array_index member Co-Authored-By: Niels Lohmann --- include/nlohmann/detail/json_pointer.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index 9a29cd4c..73db0745 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp @@ -126,8 +126,8 @@ class json_pointer /*! @brief append an array index at the end of this JSON pointer - @param[in] array_indx array index to append - @return JSON pointer with @a array_indx appended + @param[in] array_idx array index to append + @return JSON pointer with @a array_idx appended @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add} @@ -139,9 +139,9 @@ class json_pointer @since version 3.6.0 */ - json_pointer& operator/=(std::size_t array_indx) + json_pointer& operator/=(std::size_t array_idx) { - return *this /= std::to_string(array_indx); + return *this /= std::to_string(array_idx); } /*! @@ -189,8 +189,8 @@ class json_pointer @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer @param[in] ptr JSON pointer - @param[in] array_indx array index - @return a new JSON pointer with @a array_indx appended to @a ptr + @param[in] array_idx array index + @return a new JSON pointer with @a array_idx appended to @a ptr @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary} @@ -200,9 +200,9 @@ class json_pointer @since version 3.6.0 */ - friend json_pointer operator/(const json_pointer& ptr, std::size_t array_indx) + friend json_pointer operator/(const json_pointer& ptr, std::size_t array_idx) { - return json_pointer(ptr) /= array_indx; + return json_pointer(ptr) /= array_idx; } /*!