From c4a77deae1869e98217fac3d35ad436ffacd6204 Mon Sep 17 00:00:00 2001 From: Daniel Parker Date: Sun, 19 Jan 2020 11:26:25 -0500 Subject: [PATCH] New version of optional --- include/jsoncons/detail/optional.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/jsoncons/detail/optional.hpp b/include/jsoncons/detail/optional.hpp index 3ebc9bf182..c449f2c293 100644 --- a/include/jsoncons/detail/optional.hpp +++ b/include/jsoncons/detail/optional.hpp @@ -93,15 +93,6 @@ namespace detail destroy(); } - void destroy() noexcept - { - if (has_value_) - { - value_.~T(); - has_value_ = false; - } - } - optional& operator=( const optional& other ) = default; optional& operator=(optional&& other ) = default; @@ -238,6 +229,15 @@ namespace detail has_value_ = true; } + void destroy() noexcept + { + if (has_value_) + { + value_.~T(); + has_value_ = false; + } + } + template void assign(U&& u) {