From: Jacob Lifshay Date: Sat, 3 Jun 2017 01:18:24 +0000 (-0700) Subject: fix bugs in variant and optional X-Git-Tag: gsoc-2017~113 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f493fccf55f57c3ecdd5564cd5089fcb8546d9bc;p=kazan.git fix bugs in variant and optional --- diff --git a/src/util/optional.h b/src/util/optional.h index 699d700..25f0e40 100644 --- a/src/util/optional.h +++ b/src/util/optional.h @@ -401,6 +401,7 @@ public: using base::base; using base::operator=; using base::reset; + using base::emplace; constexpr optional() noexcept = default; template ::is_nothrow_move_assignable) \ - { \ - if(index_value.get() == rt.index_value.get()) \ - { \ - values.move_assign(std::move(rt.values), index_value.get()); \ - } \ - else \ - { \ - values.destruct(index_value.get()); \ - index_value.set(variant_npos); /* in case move_construct throws*/ \ - values.move_construct(std::move(rt), rt.index_value.get()); \ - index_value = rt.index_value; \ - } \ - return *this; \ +#define VULKAN_CPU_UTIL_VARIANT_BASE_MOVE_ASSIGN_OP_true \ + variant_base &operator=(variant_base &&rt) noexcept( \ + detail::variant_values::is_nothrow_move_assignable) \ + { \ + if(index_value.get() == rt.index_value.get()) \ + { \ + values.move_assign(std::move(rt.values), index_value.get()); \ + } \ + else \ + { \ + values.destruct(index_value.get()); \ + index_value.set(variant_npos); /* in case move_construct throws*/ \ + values.move_construct(std::move(rt.values), rt.index_value.get()); \ + index_value = rt.index_value; \ + } \ + return *this; \ } #define VULKAN_CPU_UTIL_VARIANT_BASE_MOVE_ASSIGN_OP_false \