aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornocomer <nocomer@yandex-team.com>2023-08-18 11:48:50 +0300
committernocomer <nocomer@yandex-team.com>2023-08-18 15:10:55 +0300
commit8a2b6dd59ef13047ade3ea1bf0827706e42ed699 (patch)
tree1fa95f018f9c41f65ea4a2c71c15bde27dfe2249
parent66149805acb62a8f0828a414e9c3362d0f532e2f (diff)
downloadydb-8a2b6dd59ef13047ade3ea1bf0827706e42ed699.tar.gz
Add ctors for TStorageBase to fix TMaybe instantiation for move-only types which are trivially move-constructible
-rw-r--r--util/generic/maybe_traits.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/util/generic/maybe_traits.h b/util/generic/maybe_traits.h
index 9e9f56955e..702912c8fa 100644
--- a/util/generic/maybe_traits.h
+++ b/util/generic/maybe_traits.h
@@ -21,8 +21,14 @@ namespace NMaybe {
{
}
+ constexpr TStorageBase(TStorageBase&&) = default;
+ constexpr TStorageBase(const TStorageBase&) = default;
+
~TStorageBase() = default;
+ TStorageBase& operator=(const TStorageBase&) = default;
+ TStorageBase& operator=(TStorageBase&&) = default;
+
union {
char NullState_;
T Data_;
@@ -44,12 +50,18 @@ namespace NMaybe {
{
}
+ constexpr TStorageBase(TStorageBase&&) = default;
+ constexpr TStorageBase(const TStorageBase&) = default;
+
~TStorageBase() {
if (this->Defined_) {
this->Data_.~T();
}
}
+ TStorageBase& operator=(const TStorageBase&) = default;
+ TStorageBase& operator=(TStorageBase&&) = default;
+
union {
char NullState_;
T Data_;
@@ -136,7 +148,7 @@ namespace NMaybe {
// -------------------- MOVE ASSIGN --------------------
- template <class T, bool = std::is_trivially_copy_assignable<T>::value>
+ template <class T, bool = std::is_trivially_move_assignable<T>::value>
struct TMoveAssignBase: TCopyAssignBase<T> {
using TCopyAssignBase<T>::TCopyAssignBase;
};