From 8665e25942a74a3503a76bd59952dd42fbe7ba61 Mon Sep 17 00:00:00 2001 From: Perry Kundert Date: Wed, 4 Oct 2017 10:47:52 -0700 Subject: [PATCH] Rename get_string to move_string to imply side-effect --- src/json.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 4f996457..2d95f18d 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -2702,8 +2702,8 @@ scan_number_done: return value_float; } - /// return string value - std::string get_string() + /// return current string value (implicitly resets the token; useful only once) + std::string move_string() { return std::move( yytext ); } @@ -3004,7 +3004,7 @@ class parser { return; } - key = m_lexer.get_string(); + key = m_lexer.move_string(); bool keep_tag = false; if (keep) @@ -3142,7 +3142,7 @@ class parser case token_type::value_string: { result.m_type = value_t::string; - result.m_value = m_lexer.get_string(); + result.m_value = m_lexer.move_string(); break; }