aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-08-14 00:03:11 +0200
committer GitHub <noreply@github.com>2024-08-14 00:03:11 +0200
commit728d6d91700b8a3e64c6524e0496c444d3379313 (patch)
treeabf72a926fbf3e255def28e47f2514156e8780ff
parentd13cdd0da7a48c8f12d710e4d8c0344641e3f392 (diff)
parent35262ebf8835476e0f2c3353e132e196f7c2e615 (diff)
Merge pull request #58 from OpenVicProject/fix/csv-logger-invalidationHEADmaster
Fix CSV logger file invalid pointer
-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;
}