30#ifndef _ALLOCATED_PTR_H
31#define _ALLOCATED_PTR_H 1
33#if __cplusplus < 201103L
34# include <bits/c++0xwarning.h>
40namespace std _GLIBCXX_VISIBILITY(default)
42_GLIBCXX_BEGIN_NAMESPACE_VERSION
46 template<
typename _Alloc>
47 struct __allocated_ptr
49 using pointer =
typename allocator_traits<_Alloc>::pointer;
50 using value_type =
typename allocator_traits<_Alloc>::value_type;
53 __allocated_ptr(_Alloc& __a, pointer __ptr) noexcept
58 template<
typename _Ptr,
59 typename _Req = _Require<is_same<_Ptr, value_type*>>>
60 __allocated_ptr(_Alloc& __a, _Ptr __ptr)
62 _M_ptr(pointer_traits<pointer>::pointer_to(*__ptr))
66 __allocated_ptr(__allocated_ptr&& __gd) noexcept
67 : _M_alloc(__gd._M_alloc), _M_ptr(__gd._M_ptr)
68 { __gd._M_ptr =
nullptr; }
73 if (_M_ptr !=
nullptr)
79 operator=(std::nullptr_t)
noexcept
86 value_type* get() {
return std::__to_address(_M_ptr); }
94 template<
typename _Alloc>
95 __allocated_ptr<_Alloc>
96 __allocate_guarded(_Alloc& __a)
102_GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
ISO C++ entities toplevel namespace is std.
static constexpr pointer allocate(_Alloc &__a, size_type __n)
Allocate memory.
static constexpr void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.