meta: added meta_any::reset
This commit is contained in:
@@ -639,6 +639,11 @@ public:
|
||||
*this = meta_any{std::in_place_type<Type>, std::forward<Args>(args)...};
|
||||
}
|
||||
|
||||
/*! @brief Destroys contained object */
|
||||
void reset() {
|
||||
*this = meta_any{};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a sequence container proxy.
|
||||
* @return A sequence container proxy for the underlying object.
|
||||
|
||||
@@ -462,6 +462,18 @@ TEST_F(MetaAny, EmplaceVoid) {
|
||||
ASSERT_EQ(any, (entt::meta_any{std::in_place_type<void>}));
|
||||
}
|
||||
|
||||
TEST_F(MetaAny, Reset) {
|
||||
entt::meta_any any{42};
|
||||
|
||||
ASSERT_TRUE(any);
|
||||
ASSERT_EQ(any.type(), entt::resolve<int>());
|
||||
|
||||
any.reset();
|
||||
|
||||
ASSERT_FALSE(any);
|
||||
ASSERT_EQ(any.type(), entt::meta_type{});
|
||||
}
|
||||
|
||||
TEST_F(MetaAny, SBOSwap) {
|
||||
entt::meta_any lhs{'c'};
|
||||
entt::meta_any rhs{42};
|
||||
|
||||
Reference in New Issue
Block a user