diff options
Diffstat (limited to 'common/aloptional.h')
-rw-r--r-- | common/aloptional.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/aloptional.h b/common/aloptional.h index 79827482..269cba0e 100644 --- a/common/aloptional.h +++ b/common/aloptional.h @@ -9,7 +9,7 @@ namespace al { -#define REQUIRES(...) bool _rt=true, typename std::enable_if<_rt && (__VA_ARGS__),int>::type = 0 +#define REQUIRES(...) bool rt_=true, typename std::enable_if<rt_ && (__VA_ARGS__),bool>::type = true struct nullopt_t { }; struct in_place_t { }; @@ -61,7 +61,7 @@ public: !std::is_constructible<U&&, T>::value)> constexpr optional(U&& value) : mHasValue{true}, mValue{std::forward<U>(value)} { } - ~optional() { reset(); } + ~optional() { if(mHasValue) al::destroy_at(std::addressof(mValue)); } optional& operator=(nullopt_t) noexcept { reset(); return *this; } template<REQUIRES(std::is_copy_constructible<T>::value && std::is_copy_assignable<T>::value)> |