pinned: Remove memory support
We shouldn't implicitly support unique_ptr or shared_ptr directly,
they still need to carry an immovable object internally.
Change-Id: I458307463973607498bdea1141d9148c22f62205
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/include/stdplus/pinned.hpp b/include/stdplus/pinned.hpp
index 9e04f97..c1490b2 100644
--- a/include/stdplus/pinned.hpp
+++ b/include/stdplus/pinned.hpp
@@ -1,6 +1,5 @@
#pragma once
#include <functional>
-#include <memory>
#include <type_traits>
#include <utility>
@@ -95,16 +94,6 @@
constexpr PinnedRef(PinnedRef<U> u) noexcept : wrapper(u)
{
}
-
- template <typename U>
- constexpr PinnedRef(const std::unique_ptr<U>& u) noexcept : wrapper(*u)
- {
- }
-
- template <typename U>
- constexpr PinnedRef(const std::shared_ptr<U>& u) noexcept : wrapper(*u)
- {
- }
};
template <typename T>
@@ -116,18 +105,6 @@
template <typename T>
PinnedRef(const Pinned<T>& t) -> PinnedRef<const T>;
-template <typename T, typename Deleter>
-PinnedRef(std::unique_ptr<T, Deleter>& t) -> PinnedRef<T>;
-
-template <typename T, typename Deleter>
-PinnedRef(const std::unique_ptr<T, Deleter>& t) -> PinnedRef<T>;
-
-template <typename T>
-PinnedRef(std::shared_ptr<T>& t) -> PinnedRef<T>;
-
-template <typename T>
-PinnedRef(const std::shared_ptr<T>& t) -> PinnedRef<T>;
-
} // namespace stdplus
template <class T>
diff --git a/test/pinned.cpp b/test/pinned.cpp
index 96700c9..f33f41a 100644
--- a/test/pinned.cpp
+++ b/test/pinned.cpp
@@ -1,5 +1,4 @@
#include <gtest/gtest.h>
-#include <memory>
#include <stdplus/pinned.hpp>
#include <string>
@@ -65,16 +64,6 @@
TEST(PinnedRef, Basic)
{
- auto uptr = std::make_unique<std::string>("hi");
- PinnedRef(uptr).get()[0] = 'd';
- EXPECT_EQ("di", *uptr);
- PinnedRef<const std::string> cref(uptr);
- // cref.get()[0] = 'e';
- EXPECT_EQ("di", cref.get());
-
- auto sptr = std::make_shared<std::string>("hi");
- EXPECT_EQ("hi", PinnedRef<std::string>(sptr).get());
-
Pinned<std::string> pstr("hi");
EXPECT_EQ("hi", PinnedRef<std::string>(pstr).get());
EXPECT_EQ("hi", PinnedRef<const std::string>(pstr).get());