diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-08-17 23:36:53 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-08-17 23:36:53 +0200 |
commit | 6c9695d16c157e9119dcf897266e8643e6565213 (patch) | |
tree | 6f96470fb1a56234f18c1561f3b96eb301fffe1c /option.h | |
parent | 851d4fb9db087eeb183f1c1cb5d96829a32e690b (diff) | |
download | cpp-utils-6c9695d16c157e9119dcf897266e8643e6565213.tar.gz cpp-utils-6c9695d16c157e9119dcf897266e8643e6565213.zip |
enable misc-*,bugprone-* lints
Diffstat (limited to 'option.h')
-rw-r--r-- | option.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -33,20 +33,20 @@ struct option { constexpr option(const option& op) : m_has_value{op.has_value()} { if (op.has_value()) { // Copy construct from inner VALUE of OP. - new (m_value) T(op.value()); + new (&m_value) T(op.value()); } } constexpr option(option&& op) noexcept : m_has_value{op.has_value()} { if (op.m_has_value) { // Move construct from inner VALUE of OP. - new (m_value) T(std::move(op.take())); + new (&m_value) T(std::move(op.take())); } } template <typename U = T> constexpr option(T&& val) : m_has_value{true} { - new (m_value) T(std::move(val)); + new (&m_value) T(std::move(val)); } // -- DESTRUCTOR ------------------------------------------------------------- @@ -60,7 +60,7 @@ struct option { template <typename... Params> constexpr T& emplace(Params&&... params) { reset(); - new (m_value) T(std::forward<Params>(params)...); + new (&m_value) T(std::forward<Params>(params)...); m_has_value = true; return value(); } |