summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libjsonpp/jsonFlexLexer.cpp16
-rw-r--r--libjsonpp/jsonFlexLexer.h4
2 files changed, 10 insertions, 10 deletions
diff --git a/libjsonpp/jsonFlexLexer.cpp b/libjsonpp/jsonFlexLexer.cpp
index 802f9e0..42aaff8 100644
--- a/libjsonpp/jsonFlexLexer.cpp
+++ b/libjsonpp/jsonFlexLexer.cpp
@@ -9,8 +9,8 @@ namespace json {
encoding(enc != UTF8 ? std::move(enc) : std::string())
{
yy_push_state(0);
- acceptValues.push([&v](const auto & value) {
- v = value;
+ acceptValues.push([&v](auto && value) {
+ v = std::move(value);
return &v;
});
}
@@ -28,8 +28,8 @@ namespace json {
jsonFlexLexer::BeginObject()
{
auto object = std::get_if<Object>(acceptValues.top()(Object()));
- acceptValues.push([object,this](const auto & value) {
- return &object->insert_or_assign(name, value).first->second;
+ acceptValues.push([object,this](auto && value) {
+ return &object->emplace(std::move(name), std::move(value)).first->second;
});
}
@@ -37,8 +37,8 @@ namespace json {
jsonFlexLexer::BeginArray()
{
auto array = std::get_if<Array>(acceptValues.top()(Array()));
- acceptValues.push([array](const auto & value) {
- return &array->emplace_back(value);
+ acceptValues.push([array](auto && value) {
+ return &array->emplace_back(std::move(value));
});
}
@@ -61,9 +61,9 @@ namespace json {
}
void
- jsonFlexLexer::PushText(const std::string & value)
+ jsonFlexLexer::PushText(std::string && value)
{
- acceptValues.top()(value);
+ acceptValues.top()(std::move(value));
}
void
diff --git a/libjsonpp/jsonFlexLexer.h b/libjsonpp/jsonFlexLexer.h
index 23f2562..b5ad9a3 100644
--- a/libjsonpp/jsonFlexLexer.h
+++ b/libjsonpp/jsonFlexLexer.h
@@ -23,7 +23,7 @@ namespace json {
void PushBoolean(bool);
void PushNumber(double);
void PushNull();
- void PushText(const std::string &);
+ void PushText(std::string &&);
void PushArray();
void PushObject();
@@ -32,7 +32,7 @@ namespace json {
std::string buf, name, encoding;
- typedef std::function<Value *(const Value &)> AcceptValue;
+ using AcceptValue = std::function<Value *(Value &&)>;
std::stack<AcceptValue> acceptValues;
};
}