From 4e8be06f46d2b8c19989b479819f5565233dc68f Mon Sep 17 00:00:00 2001 From: Redbeanw44602 Date: Fri, 28 Feb 2025 22:28:05 +0800 Subject: [PATCH] fix: fix compile. --- src/data_format/typed_symbol_list.cpp | 4 ++-- src/data_format/typed_symbol_list.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data_format/typed_symbol_list.cpp b/src/data_format/typed_symbol_list.cpp index 550a193..6c7424e 100644 --- a/src/data_format/typed_symbol_list.cpp +++ b/src/data_format/typed_symbol_list.cpp @@ -28,13 +28,13 @@ void TypedSymbolList::read(const std::filesystem::path& path) { } void TypedSymbolList::write(const std::filesystem::path& path) const { - std::ofstream ofs; + std::ofstream ofs(path); for (const auto& [symbol, decl_type] : m_data) { ofs << symbol << ", " << decl_type.string() << "\n"; } } -void TypedSymbolList::record(std::string_view symbol, DeclType type) { +void TypedSymbolList::record(const std::string& symbol, DeclType type) { m_data.emplace(symbol, type); } diff --git a/src/data_format/typed_symbol_list.h b/src/data_format/typed_symbol_list.h index 34c9b62..6c6f004 100644 --- a/src/data_format/typed_symbol_list.h +++ b/src/data_format/typed_symbol_list.h @@ -16,7 +16,7 @@ public: void read(const std::filesystem::path& path) override; void write(const std::filesystem::path& path) const override; - void record(std::string_view name, DeclType type); + void record(const std::string& symbol, DeclType type); constexpr void for_each(const for_each_callback_t& callback) const { for (const auto& entity : m_data) callback(entity);