From 0cc0ef959b34292c5d6c36e8e30238a3ff04be7c Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 5 Jul 2024 23:32:00 +0900 Subject: [PATCH] fix: directly access to member if type is the same --- include/toml11/result.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/toml11/result.hpp b/include/toml11/result.hpp index 94921f8..e847c4b 100644 --- a/include/toml11/result.hpp +++ b/include/toml11/result.hpp @@ -244,13 +244,13 @@ struct result { if(other.is_ok()) { - auto tmp = ::new(std::addressof(this->succ_)) success_type(other.as_ok()); + auto tmp = ::new(std::addressof(this->succ_)) success_type(other.succ_); assert(tmp == std::addressof(this->succ_)); (void)tmp; } else { - auto tmp = ::new(std::addressof(this->fail_)) failure_type(other.as_err()); + auto tmp = ::new(std::addressof(this->fail_)) failure_type(other.fail_); assert(tmp == std::addressof(this->fail_)); (void)tmp; } @@ -259,13 +259,13 @@ struct result { if(other.is_ok()) { - auto tmp = ::new(std::addressof(this->succ_)) success_type(std::move(other.as_ok())); + auto tmp = ::new(std::addressof(this->succ_)) success_type(std::move(other.succ_)); assert(tmp == std::addressof(this->succ_)); (void)tmp; } else { - auto tmp = ::new(std::addressof(this->fail_)) failure_type(std::move(other.as_err())); + auto tmp = ::new(std::addressof(this->fail_)) failure_type(std::move(other.fail_)); assert(tmp == std::addressof(this->fail_)); (void)tmp; } @@ -276,13 +276,13 @@ struct result this->cleanup(); if(other.is_ok()) { - auto tmp = ::new(std::addressof(this->succ_)) success_type(other.as_ok()); + auto tmp = ::new(std::addressof(this->succ_)) success_type(other.succ_); assert(tmp == std::addressof(this->succ_)); (void)tmp; } else { - auto tmp = ::new(std::addressof(this->fail_)) failure_type(other.as_err()); + auto tmp = ::new(std::addressof(this->fail_)) failure_type(other.fail_); assert(tmp == std::addressof(this->fail_)); (void)tmp; } @@ -294,13 +294,13 @@ struct result this->cleanup(); if(other.is_ok()) { - auto tmp = ::new(std::addressof(this->succ_)) success_type(std::move(other.as_ok())); + auto tmp = ::new(std::addressof(this->succ_)) success_type(std::move(other.succ_)); assert(tmp == std::addressof(this->succ_)); (void)tmp; } else { - auto tmp = ::new(std::addressof(this->fail_)) failure_type(std::move(other.as_err())); + auto tmp = ::new(std::addressof(this->fail_)) failure_type(std::move(other.fail_)); assert(tmp == std::addressof(this->fail_)); (void)tmp; }