diff --git a/include/tphrase/Generator.h b/include/tphrase/Generator.h index 21805e7..67b372d 100644 --- a/include/tphrase/Generator.h +++ b/include/tphrase/Generator.h @@ -356,12 +356,12 @@ namespace tphrase { /** The function used by Generator. \return An instance of a type not to be published for the library users. */ - DataSyntax &&move_syntax_data(); + DataSyntax &&move_syntax_data() &&; /** The function used by Generator. \return The error messages that have been generated after creating the instance or clearing the previous error messages. */ - std::string &&move_error_message(); + std::string &&move_error_message() &&; private: struct Impl; diff --git a/src/Generator.cpp b/src/Generator.cpp index 5672550..331b71f 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -100,9 +100,9 @@ namespace tphrase { } Generator::Generator(Syntax &&syntax, const std::string &start_condition) - : pimpl{new Impl{syntax.move_error_message()}} + : pimpl{new Impl{std::move(syntax).move_error_message()}} { - pimpl->data.add(syntax.move_syntax_data(), + pimpl->data.add(std::move(syntax).move_syntax_data(), start_condition, pimpl->err_msg); } @@ -175,8 +175,8 @@ namespace tphrase { bool Generator::add(Syntax &&syntax, const std::string &start_condition) { const std::size_t prev_len{pimpl->err_msg.size()}; - pimpl->err_msg += syntax.get_error_message(); - if (!pimpl->data.add(syntax.move_syntax_data(), + pimpl->err_msg += std::move(syntax).move_error_message(); + if (!pimpl->data.add(std::move(syntax).move_syntax_data(), start_condition, pimpl->err_msg)) { return false; diff --git a/src/Syntax.cpp b/src/Syntax.cpp index 9827b18..5fbe2b8 100644 --- a/src/Syntax.cpp +++ b/src/Syntax.cpp @@ -191,12 +191,12 @@ namespace tphrase { return pimpl->data; } - DataSyntax &&Syntax::move_syntax_data() + DataSyntax &&Syntax::move_syntax_data() && { return std::move(pimpl->data); } - std::string &&Syntax::move_error_message() + std::string &&Syntax::move_error_message() && { return std::move(pimpl->err_msg); }