فهرست منبع

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

Michele Caini 4 سال پیش
والد
کامیت
1979a2279f
3فایلهای تغییر یافته به همراه6 افزوده شده و 16 حذف شده
  1. 0 10
      src/entt/poly/poly.hpp
  2. 3 3
      test/entt/poly/poly_deduced.cpp
  3. 3 3
      test/entt/poly/poly_defined.cpp

+ 0 - 10
src/entt/poly/poly.hpp

@@ -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.

+ 3 - 3
test/entt/poly/poly_deduced.cpp

@@ -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);

+ 3 - 3
test/entt/poly/poly_defined.cpp

@@ -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);