forked from boostorg/variant2
Add variant<>::uses_double_storage(). Refs #37.
This commit is contained in:
1 parent
95a8c5ffec
commit
26595285d3
3 files changed
+74
No files matched your search
@@ -920,6 +920,11 @@ template<class... T> struct variant_base_impl<true, true, T...>
|
||||
|
||||
this->emplace_impl<J, U>( std::is_nothrow_constructible<U, A&&...>(), std::forward<A>(a)... );
|
||||
}
|
||||
|
||||
static constexpr bool uses_double_storage() noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// trivially destructible, double buffered
|
||||
@@ -978,6 +983,11 @@ template<class... T> struct variant_base_impl<true, false, T...>
|
||||
|
||||
ix_ = J * 2 + i2;
|
||||
}
|
||||
|
||||
static constexpr bool uses_double_storage() noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// not trivially destructible, single buffered
|
||||
@@ -1068,6 +1078,11 @@ template<class... T> struct variant_base_impl<false, true, T...>
|
||||
st_.emplace( mp11::mp_size_t<J>(), std::move(tmp) );
|
||||
ix_ = J;
|
||||
}
|
||||
|
||||
static constexpr bool uses_double_storage() noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// not trivially destructible, double buffered
|
||||
@@ -1193,6 +1208,11 @@ template<class... T> struct variant_base_impl<false, false, T...>
|
||||
|
||||
ix_ = J * 2 + i2;
|
||||
}
|
||||
|
||||
static constexpr bool uses_double_storage() noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@@ -1703,6 +1723,8 @@ public:
|
||||
|
||||
using variant_base::index;
|
||||
|
||||
using variant_base::uses_double_storage;
|
||||
|
||||
// swap
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user