From 1400dd223fb4297337266fcb5d04b700338aea71 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 1 Jul 2022 01:09:22 +0900 Subject: [PATCH] fix: #192 quick fix by checking address --- toml/value.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/toml/value.hpp b/toml/value.hpp index 1b43db8..d57ab80 100644 --- a/toml/value.hpp +++ b/toml/value.hpp @@ -247,6 +247,7 @@ class basic_value } basic_value& operator=(const basic_value& v) { + if(this == std::addressof(v)) {return *this;} this->cleanup(); this->region_info_ = v.region_info_; this->comments_ = v.comments_; @@ -269,6 +270,7 @@ class basic_value } basic_value& operator=(basic_value&& v) { + if(this == std::addressof(v)) {return *this;} this->cleanup(); this->region_info_ = std::move(v.region_info_); this->comments_ = std::move(v.comments_); @@ -1712,9 +1714,9 @@ class basic_value { switch(this->type_) { - case value_t::string : {string_.~string(); return;} - case value_t::array : {array_.~array_storage(); return;} - case value_t::table : {table_.~table_storage(); return;} + case value_t::string : {string_.~string(); return;} + case value_t::array : {array_.~array_storage(); return;} + case value_t::table : {table_.~table_storage(); return;} default : return; } }