diff --git a/include/continuable/detail/expected.hpp b/include/continuable/detail/expected.hpp index 7092d78..9472f94 100644 --- a/include/continuable/detail/expected.hpp +++ b/include/continuable/detail/expected.hpp @@ -181,7 +181,7 @@ class expected template expected(V&& value, detail::slot_t const slot) { using type = std::decay_t; - new (&storage_) type(std::forward(value)); + new (&this->storage_) type(std::forward(value)); set(slot); } @@ -259,7 +259,7 @@ public: private: template void visit(V&& visitor) { - switch (slot_) { + switch (this->slot_) { case detail::slot_t::value: return std::forward(visitor)(cast()); case detail::slot_t::error: @@ -271,7 +271,7 @@ private: } template void visit(V&& visitor) const { - switch (slot_) { + switch (this->slot_) { case detail::slot_t::value: return std::forward(visitor)(cast()); case detail::slot_t::error: @@ -289,20 +289,19 @@ private: template V& cast() noexcept { assert(!is_empty()); - return *reinterpret_cast(&storage_); + return *reinterpret_cast(&this->storage_); } template V const& cast() const noexcept { assert(!is_empty()); - return *reinterpret_cast(&storage_); + return *reinterpret_cast(&this->storage_); } template void init(V&& value) { assert(is_empty()); using type = std::decay_t; - auto storage = &storage_; - new (storage) type(std::forward(value)); + new (&this->storage_) type(std::forward(value)); } void destroy() { weak_destroy(); @@ -322,13 +321,13 @@ private: #endif } detail::slot_t get() const noexcept { - return slot_; + return this->slot_; } bool is(detail::slot_t const slot) const noexcept { return get() == slot; } void set(detail::slot_t const slot) { - slot_ = slot; + this->slot_ = slot; } }; } // namespace util