aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/ParseState.hpp
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2024-08-12 02:48:03 +0200
committer Spartan322 <Megacake1234@gmail.com>2024-08-12 02:49:00 +0200
commit35262ebf8835476e0f2c3353e132e196f7c2e615 (patch)
treeabf72a926fbf3e255def28e47f2514156e8780ff /src/openvic-dataloader/ParseState.hpp
parentd13cdd0da7a48c8f12d710e4d8c0344641e3f392 (diff)
Fix CSV logger file invalid pointerfix/csv-logger-invalidation
Add explicit move semantics to FileParseState
Diffstat (limited to 'src/openvic-dataloader/ParseState.hpp')
-rw-r--r--src/openvic-dataloader/ParseState.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/openvic-dataloader/ParseState.hpp b/src/openvic-dataloader/ParseState.hpp
index a9a9953..6d635ee 100644
--- a/src/openvic-dataloader/ParseState.hpp
+++ b/src/openvic-dataloader/ParseState.hpp
@@ -96,6 +96,21 @@ namespace ovdl {
FileParseState(const char* path, lexy::buffer<Encoding, MemoryResource>&& buffer, detail::Encoding encoding)
: FileParseState(file_type { path, std::move(buffer) }, encoding) {}
+ FileParseState(const FileParseState&) = delete;
+ FileParseState& operator=(const FileParseState&) = delete;
+
+ FileParseState(FileParseState&& other)
+ : _file { std::move(other._file) },
+ _logger { this->file() },
+ BasicParseState(std::move(other)) {}
+
+ FileParseState& operator=(FileParseState&& rhs) {
+ this->~FileParseState();
+ new (this) FileParseState(std::move(rhs));
+
+ return *this;
+ }
+
file_type& file() {
return _file;
}