summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/experimental/bits/shared_ptr.h
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/experimental/bits/shared_ptr.h')
-rw-r--r--libstdc++-v3/include/experimental/bits/shared_ptr.h666
1 files changed, 10 insertions, 656 deletions
diff --git a/libstdc++-v3/include/experimental/bits/shared_ptr.h b/libstdc++-v3/include/experimental/bits/shared_ptr.h
index e8c533e158c..8a1fc52caf8 100644
--- a/libstdc++-v3/include/experimental/bits/shared_ptr.h
+++ b/libstdc++-v3/include/experimental/bits/shared_ptr.h
@@ -46,665 +46,20 @@ namespace experimental
inline namespace fundamentals_v2
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- template<typename _Tp> class enable_shared_from_this;
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace fundamentals_v2
-} // namespace experimental
-
-#define __cpp_lib_experimental_shared_ptr_arrays 201406
-
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- /*
- * The specification of std::experimental::shared_ptr is slightly different
- * to std::shared_ptr (specifically in terms of "compatible" pointers) so
- * to implement std::experimental::shared_ptr without too much duplication
- * we make it derive from a partial specialization of std::__shared_ptr
- * using a special tag type, __libfund_v1.
- *
- * There are two partial specializations for the tag type, supporting the
- * different interfaces of the array and non-array forms.
- */
-
- template <typename _Tp, bool = is_array<_Tp>::value>
- struct __libfund_v1 { using type = _Tp; };
-
- // Partial specialization for base class of experimental::shared_ptr<T>
- // (i.e. the non-array form of experimental::shared_ptr)
- template<typename _Tp, _Lock_policy _Lp>
- class __shared_ptr<__libfund_v1<_Tp, false>, _Lp>
- : private __shared_ptr<_Tp, _Lp>
- {
- // For non-arrays, Y* is compatible with T* if Y* is convertible to T*.
- template<typename _Yp, typename _Res = void>
- using _Compatible
- = enable_if_t<experimental::is_convertible_v<_Yp*, _Tp*>, _Res>;
-
- template<typename _Yp, typename _Del,
- typename _Ptr = typename unique_ptr<_Yp, _Del>::pointer,
- typename _Res = void>
- using _UniqCompatible = enable_if_t<
- experimental::is_convertible_v<_Yp*, _Tp*>
- && experimental::is_convertible_v<_Ptr, _Tp*>,
- _Res>;
-
- using _Base_type = __shared_ptr<_Tp>;
-
- _Base_type& _M_get_base() { return *this; }
- const _Base_type& _M_get_base() const { return *this; }
-
- public:
- using element_type = _Tp;
-
- constexpr __shared_ptr() noexcept = default;
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- explicit
- __shared_ptr(_Tp1* __p)
- : _Base_type(__p)
- { }
-
- template<typename _Tp1, typename _Deleter, typename = _Compatible<_Tp1>>
- __shared_ptr(_Tp1* __p, _Deleter __d)
- : _Base_type(__p, __d)
- { }
-
- template<typename _Tp1, typename _Deleter, typename _Alloc,
- typename = _Compatible<_Tp1>>
- __shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a)
- : _Base_type(__p, __d, __a)
- { }
-
- template<typename _Deleter>
- __shared_ptr(nullptr_t __p, _Deleter __d)
- : _Base_type(__p, __d)
- { }
-
- template<typename _Deleter, typename _Alloc>
- __shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a)
- : _Base_type(__p, __d, __a)
- { }
-
- template<typename _Tp1>
- __shared_ptr(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r,
- element_type* __p) noexcept
- : _Base_type(__r._M_get_base(), __p)
- { }
-
- __shared_ptr(const __shared_ptr&) noexcept = default;
- __shared_ptr(__shared_ptr&&) noexcept = default;
- __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
- __shared_ptr& operator=(__shared_ptr&&) noexcept = default;
- ~__shared_ptr() = default;
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __shared_ptr(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
- : _Base_type(__r._M_get_base())
- { }
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __shared_ptr(__shared_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept
- : _Base_type(std::move((__r._M_get_base())))
- { }
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- explicit
- __shared_ptr(const __weak_ptr<__libfund_v1<_Tp1>, _Lp>& __r)
- : _Base_type(__r._M_get_base())
- { }
-
- template<typename _Tp1, typename _Del,
- typename = _UniqCompatible<_Tp1, _Del>>
- __shared_ptr(unique_ptr<_Tp1, _Del>&& __r)
- : _Base_type(std::move(__r))
- { }
-
-#if _GLIBCXX_USE_DEPRECATED
- // Postcondition: use_count() == 1 and __r.get() == 0
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __shared_ptr(std::auto_ptr<_Tp1>&& __r)
- : _Base_type(std::move(__r))
- { }
-#endif
-
- constexpr __shared_ptr(nullptr_t) noexcept : __shared_ptr() { }
-
- // reset
- void
- reset() noexcept
- { __shared_ptr(nullptr).swap(*this); }
-
- template<typename _Tp1>
- _Compatible<_Tp1>
- reset(_Tp1* __p)
- {
- _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != get());
- __shared_ptr(__p).swap(*this);
- }
-
- template<typename _Tp1, typename _Deleter>
- _Compatible<_Tp1>
- reset(_Tp1* __p, _Deleter __d)
- { __shared_ptr(__p, __d).swap(*this); }
-
- template<typename _Tp1, typename _Deleter, typename _Alloc>
- _Compatible<_Tp1>
- reset(_Tp1* __p, _Deleter __d, _Alloc __a)
- { __shared_ptr(__p, __d, std::move(__a)).swap(*this); }
-
- using _Base_type::operator*;
- using _Base_type::operator->;
-
- template<typename _Tp1>
- _Compatible<_Tp1, __shared_ptr&>
- operator=(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
- {
- _Base_type::operator=(__r._M_get_base());
- return *this;
- }
-
- template<class _Tp1>
- _Compatible<_Tp1, __shared_ptr&>
- operator=(__shared_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept
- {
- _Base_type::operator=(std::move(__r._M_get_base()));
- return *this;
- }
-
- template<typename _Tp1, typename _Del>
- _UniqCompatible<_Tp1, _Del, __shared_ptr&>
- operator=(unique_ptr<_Tp1, _Del>&& __r)
- {
- _Base_type::operator=(std::move(__r));
- return *this;
- }
-
-#if _GLIBCXX_USE_DEPRECATED
- template<typename _Tp1>
- _Compatible<_Tp1, __shared_ptr&>
- operator=(std::auto_ptr<_Tp1>&& __r)
- {
- _Base_type::operator=(std::move(__r));
- return *this;
- }
-#endif
-
- void
- swap(__shared_ptr& __other) noexcept
- { _Base_type::swap(__other); }
-
- template<typename _Tp1>
- bool
- owner_before(__shared_ptr<__libfund_v1<_Tp1>, _Lp> const& __rhs) const
- { return _Base_type::owner_before(__rhs._M_get_base()); }
-
- template<typename _Tp1>
- bool
- owner_before(__weak_ptr<__libfund_v1<_Tp1>, _Lp> const& __rhs) const
- { return _Base_type::owner_before(__rhs._M_get_base()); }
-
- using _Base_type::operator bool;
- using _Base_type::get;
- using _Base_type::unique;
- using _Base_type::use_count;
-
- protected:
-
- // make_shared not yet support for shared_ptr_arrays
- //template<typename _Alloc, typename... _Args>
- // __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a,
- // _Args&&... __args)
- // : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a,
- // std::forward<_Args>(__args)...)
- // {
- // void* __p = _M_refcount._M_get_deleter(typeid(__tag));
- // _M_ptr = static_cast<_Tp*>(__p);
- // }
-
- // __weak_ptr::lock()
- __shared_ptr(const __weak_ptr<__libfund_v1<_Tp>, _Lp>& __r,
- std::nothrow_t)
- : _Base_type(__r._M_get_base(), std::nothrow)
- { }
-
- private:
- template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
- template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
-
- // TODO
- template<typename _Del, typename _Tp1, _Lock_policy _Lp1>
- friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&) noexcept;
- };
-
- // Helper traits for shared_ptr of array:
- // Trait that tests if Y* is compatible with T*, for shared_ptr purposes.
- template<typename _Yp, typename _Tp>
- struct __sp_compatible
- : is_convertible<_Yp*, _Tp*>::type
- { };
+ // 8.2.1
- template<size_t _Nm, typename _Tp>
- struct __sp_compatible<_Tp[_Nm], _Tp[]>
- : true_type
- { };
-
- template<size_t _Nm, typename _Tp>
- struct __sp_compatible<_Tp[_Nm], const _Tp[]>
- : true_type
- { };
+ template<typename _Tp> class shared_ptr;
+ template<typename _Tp> class weak_ptr;
+ template<typename _Tp> class enable_shared_from_this;
template<typename _Yp, typename _Tp>
constexpr bool __sp_compatible_v
- = __sp_compatible<_Yp, _Tp>::value;
-
- // Test conversion from Y(*)[N] to U(*)[N] without forming invalid type Y[N].
- template<typename _Up, size_t _Nm, typename _Yp, typename = void>
- struct __sp_is_constructible_arrN
- : false_type
- { };
-
- template<typename _Up, size_t _Nm, typename _Yp>
- struct __sp_is_constructible_arrN<_Up, _Nm, _Yp, __void_t<_Yp[_Nm]>>
- : is_convertible<_Yp(*)[_Nm], _Up(*)[_Nm]>::type
- { };
-
- // Test conversion from Y(*)[] to U(*)[] without forming invalid type Y[].
- template<typename _Up, typename _Yp, typename = void>
- struct __sp_is_constructible_arr
- : false_type
- { };
-
- template<typename _Up, typename _Yp>
- struct __sp_is_constructible_arr<_Up, _Yp, __void_t<_Yp[]>>
- : is_convertible<_Yp(*)[], _Up(*)[]>::type
- { };
-
- // Trait to check if shared_ptr<T> can be constructed from Y*.
- template<typename _Tp, typename _Yp>
- struct __sp_is_constructible;
-
- // When T is U[N], Y(*)[N] shall be convertible to T*;
- template<typename _Up, size_t _Nm, typename _Yp>
- struct __sp_is_constructible<_Up[_Nm], _Yp>
- : __sp_is_constructible_arrN<_Up, _Nm, _Yp>::type
- { };
-
- // when T is U[], Y(*)[] shall be convertible to T*;
- template<typename _Up, typename _Yp>
- struct __sp_is_constructible<_Up[], _Yp>
- : __sp_is_constructible_arr<_Up, _Yp>::type
- { };
-
- // otherwise, Y* shall be convertible to T*.
- template<typename _Tp, typename _Yp>
- struct __sp_is_constructible
- : is_convertible<_Yp*, _Tp*>::type
- { };
+ = std::__sp_compatible_with<_Yp*, _Tp*>::value;
template<typename _Tp, typename _Yp>
constexpr bool __sp_is_constructible_v
- = __sp_is_constructible<_Tp, _Yp>::value;
-
-
- // Partial specialization for base class of experimental::shared_ptr<T[N]>
- // and experimental::shared_ptr<T[]> (i.e. the array forms).
- template<typename _Tp, _Lock_policy _Lp>
- class __shared_ptr<__libfund_v1<_Tp, true>, _Lp>
- : private __shared_ptr<remove_extent_t<_Tp>, _Lp>
- {
- public:
- using element_type = remove_extent_t<_Tp>;
-
- private:
- struct _Array_deleter
- {
- void
- operator()(element_type const *__p) const
- { delete [] __p; }
- };
-
- // Constraint for constructing/resetting with a pointer of type _Yp*:
- template<typename _Yp>
- using _SafeConv = enable_if_t<__sp_is_constructible_v<_Tp, _Yp>>;
-
- // Constraint for constructing/assigning from smart_pointer<_Tp1>:
- template<typename _Tp1, typename _Res = void>
- using _Compatible = enable_if_t<__sp_compatible_v<_Tp1, _Tp>, _Res>;
-
- // Constraint for constructing/assigning from unique_ptr<_Tp1, _Del>:
- template<typename _Tp1, typename _Del,
- typename _Ptr = typename unique_ptr<_Tp1, _Del>::pointer,
- typename _Res = void>
- using _UniqCompatible = enable_if_t<
- __sp_compatible_v<_Tp1, _Tp>
- && experimental::is_convertible_v<_Ptr, element_type*>,
- _Res>;
-
- using _Base_type = __shared_ptr<element_type>;
-
- _Base_type& _M_get_base() { return *this; }
- const _Base_type& _M_get_base() const { return *this; }
-
- public:
- constexpr __shared_ptr() noexcept
- : _Base_type()
- { }
-
- template<typename _Tp1, typename = _SafeConv<_Tp1>>
- explicit
- __shared_ptr(_Tp1* __p)
- : _Base_type(__p, _Array_deleter())
- { }
-
- template<typename _Tp1, typename _Deleter, typename = _SafeConv<_Tp1>>
- __shared_ptr(_Tp1* __p, _Deleter __d)
- : _Base_type(__p, __d)
- { }
-
- template<typename _Tp1, typename _Deleter, typename _Alloc,
- typename = _SafeConv<_Tp1>>
- __shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a)
- : _Base_type(__p, __d, __a)
- { }
-
- template<typename _Deleter>
- __shared_ptr(nullptr_t __p, _Deleter __d)
- : _Base_type(__p, __d)
- { }
-
- template<typename _Deleter, typename _Alloc>
- __shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a)
- : _Base_type(__p, __d, __a)
- { }
-
- template<typename _Tp1>
- __shared_ptr(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r,
- element_type* __p) noexcept
- : _Base_type(__r._M_get_base(), __p)
- { }
-
- __shared_ptr(const __shared_ptr&) noexcept = default;
- __shared_ptr(__shared_ptr&&) noexcept = default;
- __shared_ptr& operator=(const __shared_ptr&) noexcept = default;
- __shared_ptr& operator=(__shared_ptr&&) noexcept = default;
- ~__shared_ptr() = default;
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __shared_ptr(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
- : _Base_type(__r._M_get_base())
- { }
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __shared_ptr(__shared_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept
- : _Base_type(std::move((__r._M_get_base())))
- { }
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- explicit
- __shared_ptr(const __weak_ptr<__libfund_v1<_Tp1>, _Lp>& __r)
- : _Base_type(__r._M_get_base())
- { }
-
- template<typename _Tp1, typename _Del,
- typename = _UniqCompatible<_Tp1, _Del>>
- __shared_ptr(unique_ptr<_Tp1, _Del>&& __r)
- : _Base_type(std::move(__r))
- { }
-
-#if _GLIBCXX_USE_DEPRECATED
- // Postcondition: use_count() == 1 and __r.get() == 0
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __shared_ptr(auto_ptr<_Tp1>&& __r)
- : _Base_type(std::move(__r))
- { }
-#endif
-
- constexpr __shared_ptr(nullptr_t) noexcept : __shared_ptr() { }
-
- // reset
- void
- reset() noexcept
- { __shared_ptr(nullptr).swap(*this); }
-
- template<typename _Tp1>
- _SafeConv<_Tp1>
- reset(_Tp1* __p)
- {
- _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != get());
- __shared_ptr(__p, _Array_deleter()).swap(*this);
- }
-
- template<typename _Tp1, typename _Deleter>
- _SafeConv<_Tp1>
- reset(_Tp1* __p, _Deleter __d)
- { __shared_ptr(__p, __d).swap(*this); }
-
- template<typename _Tp1, typename _Deleter, typename _Alloc>
- _SafeConv<_Tp1>
- reset(_Tp1* __p, _Deleter __d, _Alloc __a)
- { __shared_ptr(__p, __d, std::move(__a)).swap(*this); }
-
- element_type&
- operator[](ptrdiff_t i) const noexcept
- {
- _GLIBCXX_DEBUG_ASSERT(get() != 0 && i >= 0);
- return get()[i];
- }
-
- template<typename _Tp1>
- _Compatible<_Tp1, __shared_ptr&>
- operator=(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
- {
- _Base_type::operator=(__r._M_get_base());
- return *this;
- }
-
- template<class _Tp1>
- _Compatible<_Tp1, __shared_ptr&>
- operator=(__shared_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept
- {
- _Base_type::operator=(std::move(__r._M_get_base()));
- return *this;
- }
-
- template<typename _Tp1, typename _Del>
- _UniqCompatible<_Tp1, _Del, __shared_ptr&>
- operator=(unique_ptr<_Tp1, _Del>&& __r)
- {
- _Base_type::operator=(std::move(__r));
- return *this;
- }
-
-#if _GLIBCXX_USE_DEPRECATED
- template<typename _Tp1>
- _Compatible<_Tp1, __shared_ptr&>
- operator=(auto_ptr<_Tp1>&& __r)
- {
- _Base_type::operator=(std::move(__r));
- return *this;
- }
-#endif
-
- void
- swap(__shared_ptr& __other) noexcept
- { _Base_type::swap(__other); }
-
- template<typename _Tp1>
- bool
- owner_before(__shared_ptr<__libfund_v1<_Tp1>, _Lp> const& __rhs) const
- { return _Base_type::owner_before(__rhs._M_get_base()); }
-
- template<typename _Tp1>
- bool
- owner_before(__weak_ptr<__libfund_v1<_Tp1>, _Lp> const& __rhs) const
- { return _Base_type::owner_before(__rhs._M_get_base()); }
-
- using _Base_type::operator bool;
- using _Base_type::get;
- using _Base_type::unique;
- using _Base_type::use_count;
-
- protected:
-
- // make_shared not yet support for shared_ptr_arrays
- //template<typename _Alloc, typename... _Args>
- // __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a,
- // _Args&&... __args)
- // : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a,
- // std::forward<_Args>(__args)...)
- // {
- // void* __p = _M_refcount._M_get_deleter(typeid(__tag));
- // _M_ptr = static_cast<_Tp*>(__p);
- // }
-
- // __weak_ptr::lock()
- __shared_ptr(const __weak_ptr<__libfund_v1<_Tp>, _Lp>& __r,
- std::nothrow_t)
- : _Base_type(__r._M_get_base(), std::nothrow)
- { }
-
- private:
- template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
- template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
-
- // TODO
- template<typename _Del, typename _Tp1, _Lock_policy _Lp1>
- friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&) noexcept;
- };
-
- // weak_ptr specialization for __shared_ptr array
- template<typename _Tp, _Lock_policy _Lp>
- class __weak_ptr<__libfund_v1<_Tp>, _Lp>
- : __weak_ptr<remove_extent_t<_Tp>, _Lp>
- {
- template<typename _Tp1, typename _Res = void>
- using _Compatible
- = enable_if_t<__sp_compatible_v<_Tp1, _Tp>, _Res>;
-
- using _Base_type = __weak_ptr<remove_extent_t<_Tp>>;
-
- _Base_type& _M_get_base() { return *this; }
- const _Base_type& _M_get_base() const { return *this; }
-
- public:
- using element_type = remove_extent_t<_Tp>;
-
- constexpr __weak_ptr() noexcept
- : _Base_type()
- { }
-
- __weak_ptr(const __weak_ptr&) noexcept = default;
-
- ~__weak_ptr() = default;
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __weak_ptr(const __weak_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
- : _Base_type(__r._M_get_base())
- { }
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __weak_ptr(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
- : _Base_type(__r._M_get_base())
- { }
-
- __weak_ptr(__weak_ptr&& __r) noexcept
- : _Base_type(std::move(__r))
- { }
-
- template<typename _Tp1, typename = _Compatible<_Tp1>>
- __weak_ptr(__weak_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept
- : _Base_type(std::move(__r._M_get_base()))
- { }
-
- __weak_ptr&
- operator=(const __weak_ptr& __r) noexcept = default;
-
- template<typename _Tp1>
- _Compatible<_Tp1, __weak_ptr&>
- operator=(const __weak_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
- {
- this->_Base_type::operator=(__r._M_get_base());
- return *this;
- }
-
- template<typename _Tp1>
- _Compatible<_Tp1, __weak_ptr&>
- operator=(const __shared_ptr<_Tp1, _Lp>& __r) noexcept
- {
- this->_Base_type::operator=(__r._M_get_base());
- return *this;
- }
-
- __weak_ptr&
- operator=(__weak_ptr&& __r) noexcept
- {
- this->_Base_type::operator=(std::move(__r));
- return *this;
- }
-
- template<typename _Tp1>
- _Compatible<_Tp1, __weak_ptr&>
- operator=(__weak_ptr<_Tp1, _Lp>&& __r) noexcept
- {
- this->_Base_type::operator=(std::move(__r._M_get_base()));
- return *this;
- }
-
- void
- swap(__weak_ptr& __other) noexcept
- { this->_Base_type::swap(__other); }
-
- template<typename _Tp1>
- bool
- owner_before(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __rhs) const
- { return _Base_type::owner_before(__rhs._M_get_base()); }
-
- template<typename _Tp1>
- bool
- owner_before(const __weak_ptr<__libfund_v1<_Tp1>, _Lp>& __rhs) const
- { return _Base_type::owner_before(__rhs._M_get_base()); }
-
- __shared_ptr<__libfund_v1<_Tp>, _Lp>
- lock() const noexcept // should not be element_type
- { return __shared_ptr<__libfund_v1<_Tp>, _Lp>(*this, std::nothrow); }
-
- using _Base_type::use_count;
- using _Base_type::expired;
- using _Base_type::reset;
-
- private:
- // Used by __enable_shared_from_this.
- void
- _M_assign(element_type* __ptr,
- const __shared_count<_Lp>& __refcount) noexcept
- { this->_Base_type::_M_assign(__ptr, __refcount); }
-
- template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
- template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
- friend class __enable_shared_from_this<_Tp, _Lp>;
- friend class experimental::enable_shared_from_this<_Tp>;
- friend class enable_shared_from_this<_Tp>;
- };
-
-_GLIBCXX_END_NAMESPACE_VERSION
-
-namespace experimental
-{
-inline namespace fundamentals_v2
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- // 8.2.1
-
- template<typename _Tp> class shared_ptr;
- template<typename _Tp> class weak_ptr;
-
- template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
- using __shared_ptr = std::__shared_ptr<__libfund_v1<_Tp>, _Lp>;
-
- template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
- using __weak_ptr = std::__weak_ptr<__libfund_v1<_Tp>, _Lp>;
+ = std::__sp_is_constructible<_Tp, _Yp>::value;
template<typename _Tp>
class shared_ptr : public __shared_ptr<_Tp>
@@ -1128,16 +483,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ __a.swap(__b); }
/// C++14 §20.8.2.2.10
- template<typename _Del, typename _Tp, _Lock_policy _Lp>
+ template<typename _Del, typename _Tp>
inline _Del*
- get_deleter(const __shared_ptr<_Tp, _Lp>& __p) noexcept
+ get_deleter(const shared_ptr<_Tp>& __p) noexcept
{ return std::get_deleter<_Del>(__p); }
// C++14 §20.8.2.2.11
- template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp>
+ template<typename _Ch, typename _Tr, typename _Tp>
inline std::basic_ostream<_Ch, _Tr>&
- operator<<(std::basic_ostream<_Ch, _Tr>& __os,
- const __shared_ptr<_Tp, _Lp>& __p)
+ operator<<(std::basic_ostream<_Ch, _Tr>& __os, const shared_ptr<_Tp>& __p)
{
__os << __p.get();
return __os;