diff options
author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2024-01-02 13:31:23 +0000 |
---|---|---|
committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2024-01-02 13:31:23 +0000 |
commit | ef9ece507205506f5694b9578cf89e9f4f0a43b2 (patch) | |
tree | 72e74cdba4fb3ed5768345ba1fca0f4bc5ddf431 | |
parent | Remove virtual and wordy traits use (diff) | |
download | gentoobrowse-api-ef9ece507205506f5694b9578cf89e9f4f0a43b2.tar.bz2 gentoobrowse-api-ef9ece507205506f5694b9578cf89e9f4f0a43b2.tar.xz gentoobrowse-api-ef9ece507205506f5694b9578cf89e9f4f0a43b2.zip |
Support moving buffer from unpackPqTextArray direct target listgentoobrowse-api-0.12.4
-rw-r--r-- | gentoobrowse-api/domain/converters.impl.h | 4 | ||||
-rw-r--r-- | gentoobrowse-api/domain/unpackPqTextArray.h | 2 | ||||
-rw-r--r-- | gentoobrowse-api/domain/unpackPqTextArray.ll | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/gentoobrowse-api/domain/converters.impl.h b/gentoobrowse-api/domain/converters.impl.h index 10afa79..f6b6bad 100644 --- a/gentoobrowse-api/domain/converters.impl.h +++ b/gentoobrowse-api/domain/converters.impl.h @@ -10,7 +10,7 @@ namespace Slicer { UnpackPqTextArrayInto(std::istream & s, std::vector<T> & l) : UnpackPqTextArray(s), list(l) { } void - consume(const std::string & s) override + consume(std::string s) override { if constexpr (std::is_arithmetic_v<T>) { if (std::from_chars(s.c_str(), s.c_str() + s.length(), list.emplace_back()).ec != std::error_code {}) { @@ -18,7 +18,7 @@ namespace Slicer { } } else { - list.emplace_back(s); + list.emplace_back(std::move(s)); } } diff --git a/gentoobrowse-api/domain/unpackPqTextArray.h b/gentoobrowse-api/domain/unpackPqTextArray.h index 6e39f52..47c4cb7 100644 --- a/gentoobrowse-api/domain/unpackPqTextArray.h +++ b/gentoobrowse-api/domain/unpackPqTextArray.h @@ -14,7 +14,7 @@ namespace Slicer { int yylex() override; void LexerError(const char * msg) override; - virtual void consume(const std::string &) = 0; + virtual void consume(std::string) = 0; private: std::string buffer; diff --git a/gentoobrowse-api/domain/unpackPqTextArray.ll b/gentoobrowse-api/domain/unpackPqTextArray.ll index d2aca16..b24344d 100644 --- a/gentoobrowse-api/domain/unpackPqTextArray.ll +++ b/gentoobrowse-api/domain/unpackPqTextArray.ll @@ -11,6 +11,7 @@ #include "unpackPqTextArray.h" #include <stdexcept> #include <string> +#include <utility> class pqBaseFlexLexer; #pragma GCC diagnostic ignored "-Wconversion" @@ -57,7 +58,7 @@ char [^"] BEGIN(NEXT); } <QUOTED>{quote} { - consume(buffer); + consume(std::move(buffer)); BEGIN(AFTER); } <QUOTED>{esc} { |