diff options
author | George L. Albany <Megacake1234@gmail.com> | 2024-08-11 12:28:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-11 12:28:37 +0200 |
commit | d13cdd0da7a48c8f12d710e4d8c0344641e3f392 (patch) | |
tree | 05cb6ce7a3e4f5f5af01498e7ee0f95e4fea1692 /src/openvic-dataloader/ParseState.hpp | |
parent | efcc544bb36c80efb911390855c0123d5d11f742 (diff) | |
parent | 9617863bbb82fbe5c3c203dec2b9a7d7f6a746d5 (diff) |
Merge pull request #57 from OpenVicProject/fix/logger-invalidation
Fix logger file invalid pointer
Diffstat (limited to 'src/openvic-dataloader/ParseState.hpp')
-rw-r--r-- | src/openvic-dataloader/ParseState.hpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/openvic-dataloader/ParseState.hpp b/src/openvic-dataloader/ParseState.hpp index 259f2a5..a9a9953 100644 --- a/src/openvic-dataloader/ParseState.hpp +++ b/src/openvic-dataloader/ParseState.hpp @@ -1,7 +1,5 @@ #pragma once -#include <utility> - #include <openvic-dataloader/detail/Encoding.hpp> #include <lexy/encoding.hpp> @@ -37,6 +35,18 @@ namespace ovdl { _logger { this->ast().file() }, BasicParseState(encoding) {} + ParseState(ParseState&& other) + : _ast { std::move(other._ast) }, + _logger { this->ast().file() }, + BasicParseState(other.encoding()) {} + + ParseState& operator=(ParseState&& rhs) { + this->~ParseState(); + new (this) ParseState(std::move(rhs)); + + return *this; + } + template<typename Encoding, typename MemoryResource = void> ParseState(lexy::buffer<Encoding, MemoryResource>&& buffer, detail::Encoding encoding) : ParseState(typename ast_type::file_type { std::move(buffer) }, encoding) {} |