aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Halle <niklas@niklashalle.net>2020-08-24 12:25:36 +0200
committerNiklas Halle <niklas@niklashalle.net>2020-08-24 12:25:56 +0200
commit61464b6d069513eda07e4fc2638c8889cbce98f5 (patch)
tree23c05dc35d775e8647eb84b1a9f1f768aa70c88b
parent2b3bf7be9263e2081db1d31f090c9433e307b9fa (diff)
downloadn_core-61464b6d069513eda07e4fc2638c8889cbce98f5.tar.gz
n_core-61464b6d069513eda07e4fc2638c8889cbce98f5.zip
replace push_back(move) with emplace_back
-rw-r--r--src/main.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/main.cpp b/src/main.cpp
index ce6b7a8..6e39f1c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -100,13 +100,13 @@ json wikiHandler(std::string const &arguments, std::string const &session, void
(void) payload;
std::vector<json> linkAnnotations;
- linkAnnotations.push_back(std::move(create_annotation(Reply::AnnotationType::link, "Wikipedia")));
- linkAnnotations.push_back(std::move(create_annotation(Reply::AnnotationType::underline)));
+ linkAnnotations.emplace_back(create_annotation(Reply::AnnotationType::link, "Wikipedia"));
+ linkAnnotations.emplace_back(create_annotation(Reply::AnnotationType::underline));
std::vector<json> reply_vec;
- reply_vec.push_back(std::move(create_text("Visit ")));
- reply_vec.push_back(std::move(create_text("https://eo.wikipedia.org/", std::move(linkAnnotations))));
- reply_vec.push_back(std::move(create_text(" today!")));
+ reply_vec.emplace_back(create_text("Visit "));
+ reply_vec.emplace_back(create_text("https://eo.wikipedia.org/", std::move(linkAnnotations)));
+ reply_vec.emplace_back(create_text(" today!"));
return create_response(std::move(reply_vec), session, true);
}
@@ -115,27 +115,27 @@ json helpHandler(std::string const &arguments, std::string const &session, void
auto commands = *(std::unordered_map<std::string, CommandHandler> *) payload;
std::vector<json> reply_vec;
- reply_vec.push_back(std::move(create_text(
+ reply_vec.emplace_back(create_text(
"Reading from the gospel according to saint N,\n"
"And you shall feast upon the fruits and vegetables as I do in the offering for they will make you strong.\n"
"\n"
"Dear my fellow users, these are my official commands, which are offered to my believers.\n"
- "\n")));
+ "\n"));
for (auto const &itor : commands) {
std::vector<json> commandAnnotations;
- commandAnnotations.push_back(std::move(create_annotation(Reply::AnnotationType::command)));
+ commandAnnotations.emplace_back(create_annotation(Reply::AnnotationType::command));
- reply_vec.push_back(std::move(create_text("- ")));
- reply_vec.push_back(std::move(create_text(itor.first, std::move(commandAnnotations))));
- reply_vec.push_back(std::move(create_text(" " + itor.second.description + "\n")));
+ reply_vec.emplace_back(create_text("- "));
+ reply_vec.emplace_back(create_text(itor.first, std::move(commandAnnotations)));
+ reply_vec.emplace_back(create_text(" " + itor.second.description + "\n"));
}
- reply_vec.push_back(std::move(create_text(
+ reply_vec.emplace_back(create_text(
"\n"
"Thanks for using me. Takk skal du ha.\n"
"Bussy\n"
- "N")));
+ "N"));
return create_response(std::move(reply_vec), session, true);
}
@@ -145,10 +145,10 @@ json stopHandler(std::string const &arguments, std::string const &session, void
app->stop();
std::vector<json> annotations;
- annotations.push_back(std::move(create_annotation(Reply::AnnotationType::bold)));
+ annotations.emplace_back(create_annotation(Reply::AnnotationType::bold));
std::vector<json> reply_vec;
- reply_vec.push_back(std::move(create_text("stopped", std::move(annotations))));
+ reply_vec.emplace_back(create_text("stopped", std::move(annotations)));
return create_response(std::move(reply_vec), session, true);
}
@@ -157,7 +157,7 @@ json stopHandler(std::string const &arguments, std::string const &session, void
json simple_response(std::string const &text, std::string const &session, bool success) {
std::vector<json> reply_vec;
- reply_vec.push_back(std::move(create_text(text)));
+ reply_vec.emplace_back(create_text(text));
return create_response(std::move(reply_vec), session, success);
}
@@ -171,7 +171,7 @@ json create_annotation(Reply::AnnotationType annotationType, std::string const &
json create_text(std::string const &text) {
std::vector<json> annotations;
- annotations.push_back(std::move(create_annotation()));
+ annotations.emplace_back(create_annotation());
return create_text(text, std::move(annotations));
}