poly: deprecate type() in favor of info() for consistency
This commit is contained in:
@@ -36,4 +36,4 @@ TODO:
|
||||
* improve non-const allow cast with in-place switch
|
||||
* meta fixed_size could return the size directly if present
|
||||
* setup testbed workflow on the CI and review build process for testbed (i.e. tests first due to SDL)
|
||||
* type() -> info() for consistency (poly, sparse_set)
|
||||
* type() -> info() for consistency (sparse_set)
|
||||
|
||||
@@ -223,13 +223,18 @@ public:
|
||||
: basic_poly{std::in_place_type<std::remove_cv_t<std::remove_reference_t<Type>>>, std::forward<Type>(value)} {}
|
||||
|
||||
/**
|
||||
* @brief Returns the object type if any, `type_id<void>()` otherwise.
|
||||
* @return The object type if any, `type_id<void>()` otherwise.
|
||||
* @brief Returns the object type info if any, `type_id<void>()` otherwise.
|
||||
* @return The object type info if any, `type_id<void>()` otherwise.
|
||||
*/
|
||||
[[nodiscard]] const type_info &type() const noexcept {
|
||||
[[nodiscard]] const type_info &info() const noexcept {
|
||||
return storage.info();
|
||||
}
|
||||
|
||||
/*! @copydoc info */
|
||||
[[deprecated("use ::info instead")]] [[nodiscard]] const type_info &type() const noexcept {
|
||||
return info();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns an opaque pointer to the contained instance.
|
||||
* @return An opaque pointer the contained instance, if any.
|
||||
|
||||
@@ -236,9 +236,9 @@ TYPED_TEST(Poly, Functionalities) {
|
||||
ASSERT_TRUE(alias);
|
||||
ASSERT_TRUE(value);
|
||||
|
||||
ASSERT_EQ(empty.type(), entt::type_id<void>());
|
||||
ASSERT_EQ(empty.info(), entt::type_id<void>());
|
||||
ASSERT_EQ(in_place.type(), entt::type_id<impl>());
|
||||
ASSERT_EQ(alias.type(), entt::type_id<impl>());
|
||||
ASSERT_EQ(alias.info(), entt::type_id<impl>());
|
||||
ASSERT_EQ(value.type(), entt::type_id<impl>());
|
||||
|
||||
ASSERT_EQ(alias.data(), &instance);
|
||||
@@ -251,7 +251,7 @@ TYPED_TEST(Poly, Functionalities) {
|
||||
ASSERT_TRUE(empty);
|
||||
ASSERT_NE(empty.data(), nullptr);
|
||||
ASSERT_NE(std::as_const(empty).data(), nullptr);
|
||||
ASSERT_EQ(empty.type(), entt::type_id<impl>());
|
||||
ASSERT_EQ(empty.info(), entt::type_id<impl>());
|
||||
ASSERT_EQ(empty->get(), 0);
|
||||
|
||||
empty.template emplace<impl>(3);
|
||||
@@ -265,7 +265,7 @@ TYPED_TEST(Poly, Functionalities) {
|
||||
ASSERT_NE(ref.data(), nullptr);
|
||||
ASSERT_EQ(ref.data(), in_place.data());
|
||||
ASSERT_EQ(std::as_const(ref).data(), std::as_const(in_place).data());
|
||||
ASSERT_EQ(ref.type(), entt::type_id<impl>());
|
||||
ASSERT_EQ(ref.info(), entt::type_id<impl>());
|
||||
ASSERT_EQ(ref->get(), 3);
|
||||
|
||||
poly_type null{};
|
||||
@@ -288,7 +288,7 @@ TYPED_TEST(Poly, Functionalities) {
|
||||
move.reset();
|
||||
|
||||
ASSERT_FALSE(move);
|
||||
ASSERT_EQ(move.type(), entt::type_id<void>());
|
||||
ASSERT_EQ(move.info(), entt::type_id<void>());
|
||||
}
|
||||
|
||||
TYPED_TEST(Poly, Owned) {
|
||||
|
||||
Reference in New Issue
Block a user