poly: removed std::reference_wrapper support (incomplete, breaking change)

This commit is contained in:
Michele Caini
2021-04-26 00:17:49 +02:00
parent 1434f942dd
commit 1979a2279f
3 changed files with 6 additions and 16 deletions

View File

@@ -206,16 +206,6 @@ public:
vtable{poly_vtable<Concept, Len, Align>::template instance<std::remove_const_t<std::remove_reference_t<Type>>>()}
{}
/**
* @brief Constructs a poly that holds an unmanaged object.
* @tparam Type Type of object to use to initialize the poly.
* @param value An instance of an object to use to initialize the poly.
*/
template<typename Type>
basic_poly(std::reference_wrapper<Type> value)
: basic_poly{std::in_place_type<Type &>, value.get()}
{}
/**
* @brief Constructs a poly from a given value.
* @tparam Type Type of object to use to initialize the poly.

View File

@@ -48,7 +48,7 @@ TEST(PolyDeduced, Functionalities) {
entt::poly<Deduced> empty{};
entt::poly<Deduced> in_place{std::in_place_type<impl>, 3};
entt::poly<Deduced> alias{std::ref(instance)};
entt::poly<Deduced> alias{std::in_place_type<impl &>, instance};
entt::poly<Deduced> value{impl{}};
ASSERT_FALSE(empty);
@@ -134,7 +134,7 @@ TEST(PolyDeduced, Owned) {
TEST(PolyDeduced, Reference) {
impl instance{};
entt::poly<Deduced> poly{std::ref(instance)};
entt::poly<Deduced> poly{std::in_place_type<impl &>, instance};
ASSERT_TRUE(poly);
ASSERT_NE(poly.data(), nullptr);
@@ -158,7 +158,7 @@ TEST(PolyDeduced, Reference) {
TEST(PolyDeduced, ConstReference) {
impl instance{};
entt::poly<Deduced> poly{std::cref(instance)};
entt::poly<Deduced> poly{std::in_place_type<const impl &>, instance};
ASSERT_TRUE(poly);
ASSERT_EQ(poly.data(), nullptr);

View File

@@ -54,7 +54,7 @@ TEST(PolyDefined, Functionalities) {
entt::poly<Defined> empty{};
entt::poly<Defined> in_place{std::in_place_type<impl>, 3};
entt::poly<Defined> alias{std::ref(instance)};
entt::poly<Defined> alias{std::in_place_type<impl &>, instance};
entt::poly<Defined> value{impl{}};
ASSERT_FALSE(empty);
@@ -140,7 +140,7 @@ TEST(PolyDefined, Owned) {
TEST(PolyDefined, Reference) {
impl instance{};
entt::poly<Defined> poly{std::ref(instance)};
entt::poly<Defined> poly{std::in_place_type<impl &>, instance};
ASSERT_TRUE(poly);
ASSERT_NE(poly.data(), nullptr);
@@ -164,7 +164,7 @@ TEST(PolyDefined, Reference) {
TEST(PolyDefined, ConstReference) {
impl instance{};
entt::poly<Defined> poly{std::cref(instance)};
entt::poly<Defined> poly{std::in_place_type<const impl &>, instance};
ASSERT_TRUE(poly);
ASSERT_EQ(poly.data(), nullptr);