1 // unique_ptr implementation -*- C++ -*-
3 // Copyright (C) 2008-2016 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
25 /** @file bits/unique_ptr.h
26 * This is an internal header file, included by other library headers.
27 * Do not attempt to use it directly. @headername{memory}
31 #define _UNIQUE_PTR_H 1
33 #include <bits/c++config.h>
34 #include <debug/assertions.h>
35 #include <type_traits>
39 namespace std
_GLIBCXX_VISIBILITY(default)
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
44 * @addtogroup pointer_abstractions
48 #if _GLIBCXX_USE_DEPRECATED
49 template<typename
> class auto_ptr
;
52 /// Primary template of default_delete, used by unique_ptr
53 template<typename _Tp
>
56 /// Default constructor
57 constexpr default_delete() noexcept
= default;
59 /** @brief Converting constructor.
61 * Allows conversion from a deleter for arrays of another type, @p _Up,
62 * only if @p _Up* is convertible to @p _Tp*.
64 template<typename _Up
, typename
= typename
65 enable_if
<is_convertible
<_Up
*, _Tp
*>::value
>::type
>
66 default_delete(const default_delete
<_Up
>&) noexcept
{ }
68 /// Calls @c delete @p __ptr
70 operator()(_Tp
* __ptr
) const
72 static_assert(!is_void
<_Tp
>::value
,
73 "can't delete pointer to incomplete type");
74 static_assert(sizeof(_Tp
)>0,
75 "can't delete pointer to incomplete type");
80 // _GLIBCXX_RESOLVE_LIB_DEFECTS
81 // DR 740 - omit specialization for array objects with a compile time length
82 /// Specialization for arrays, default_delete.
83 template<typename _Tp
>
84 struct default_delete
<_Tp
[]>
87 /// Default constructor
88 constexpr default_delete() noexcept
= default;
90 /** @brief Converting constructor.
92 * Allows conversion from a deleter for arrays of another type, such as
93 * a const-qualified version of @p _Tp.
95 * Conversions from types derived from @c _Tp are not allowed because
96 * it is unsafe to @c delete[] an array of derived types through a
97 * pointer to the base type.
99 template<typename _Up
, typename
= typename
100 enable_if
<is_convertible
<_Up(*)[], _Tp(*)[]>::value
>::type
>
101 default_delete(const default_delete
<_Up
[]>&) noexcept
{ }
103 /// Calls @c delete[] @p __ptr
104 template<typename _Up
>
105 typename enable_if
<is_convertible
<_Up(*)[], _Tp(*)[]>::value
>::type
106 operator()(_Up
* __ptr
) const
108 static_assert(sizeof(_Tp
)>0,
109 "can't delete pointer to incomplete type");
114 /// 20.7.1.2 unique_ptr for single objects.
115 template <typename _Tp
, typename _Dp
= default_delete
<_Tp
> >
118 // use SFINAE to determine whether _Del::pointer exists
121 template<typename _Up
>
122 static typename
_Up::pointer
__test(typename
_Up::pointer
*);
124 template<typename _Up
>
125 static _Tp
* __test(...);
127 typedef typename remove_reference
<_Dp
>::type _Del
;
130 typedef decltype(__test
<_Del
>(0)) type
;
133 typedef std::tuple
<typename
_Pointer::type
, _Dp
> __tuple_type
;
137 typedef typename
_Pointer::type pointer
;
138 typedef _Tp element_type
;
139 typedef _Dp deleter_type
;
142 // helper template for detecting a safe conversion from another
144 template<typename _Up
, typename _Ep
>
145 using __safe_conversion_up
= __and_
<
146 is_convertible
<typename unique_ptr
<_Up
, _Ep
>::pointer
, pointer
>,
147 __not_
<is_array
<_Up
>>,
148 __or_
<__and_
<is_reference
<deleter_type
>,
149 is_same
<deleter_type
, _Ep
>>,
150 __and_
<__not_
<is_reference
<deleter_type
>>,
151 is_convertible
<_Ep
, deleter_type
>>
157 /// Default constructor, creates a unique_ptr that owns nothing.
158 constexpr unique_ptr() noexcept
160 { static_assert(!is_pointer
<deleter_type
>::value
,
161 "constructed with null function pointer deleter"); }
163 /** Takes ownership of a pointer.
165 * @param __p A pointer to an object of @c element_type
167 * The deleter will be value-initialized.
170 unique_ptr(pointer __p
) noexcept
171 : _M_t(__p
, deleter_type())
172 { static_assert(!is_pointer
<deleter_type
>::value
,
173 "constructed with null function pointer deleter"); }
175 /** Takes ownership of a pointer.
177 * @param __p A pointer to an object of @c element_type
178 * @param __d A reference to a deleter.
180 * The deleter will be initialized with @p __d
182 unique_ptr(pointer __p
,
183 typename conditional
<is_reference
<deleter_type
>::value
,
184 deleter_type
, const deleter_type
&>::type __d
) noexcept
187 /** Takes ownership of a pointer.
189 * @param __p A pointer to an object of @c element_type
190 * @param __d An rvalue reference to a deleter.
192 * The deleter will be initialized with @p std::move(__d)
194 unique_ptr(pointer __p
,
195 typename remove_reference
<deleter_type
>::type
&& __d
) noexcept
196 : _M_t(std::move(__p
), std::move(__d
))
197 { static_assert(!std::is_reference
<deleter_type
>::value
,
198 "rvalue deleter bound to reference"); }
200 /// Creates a unique_ptr that owns nothing.
201 constexpr unique_ptr(nullptr_t
) noexcept
: unique_ptr() { }
203 // Move constructors.
205 /// Move constructor.
206 unique_ptr(unique_ptr
&& __u
) noexcept
207 : _M_t(__u
.release(), std::forward
<deleter_type
>(__u
.get_deleter())) { }
209 /** @brief Converting constructor from another type
211 * Requires that the pointer owned by @p __u is convertible to the
212 * type of pointer owned by this object, @p __u does not own an array,
213 * and @p __u has a compatible deleter type.
215 template<typename _Up
, typename _Ep
, typename
= _Require
<
216 __safe_conversion_up
<_Up
, _Ep
>,
217 typename conditional
<is_reference
<_Dp
>::value
,
219 is_convertible
<_Ep
, _Dp
>>::type
>>
220 unique_ptr(unique_ptr
<_Up
, _Ep
>&& __u
) noexcept
221 : _M_t(__u
.release(), std::forward
<_Ep
>(__u
.get_deleter()))
224 #if _GLIBCXX_USE_DEPRECATED
225 /// Converting constructor from @c auto_ptr
226 template<typename _Up
, typename
= _Require
<
227 is_convertible
<_Up
*, _Tp
*>, is_same
<_Dp
, default_delete
<_Tp
>>>>
228 unique_ptr(auto_ptr
<_Up
>&& __u
) noexcept
;
231 /// Destructor, invokes the deleter if the stored pointer is not null.
232 ~unique_ptr() noexcept
234 auto& __ptr
= std::get
<0>(_M_t
);
235 if (__ptr
!= nullptr)
236 get_deleter()(__ptr
);
242 /** @brief Move assignment operator.
244 * @param __u The object to transfer ownership from.
246 * Invokes the deleter first if this object owns a pointer.
249 operator=(unique_ptr
&& __u
) noexcept
251 reset(__u
.release());
252 get_deleter() = std::forward
<deleter_type
>(__u
.get_deleter());
256 /** @brief Assignment from another type.
258 * @param __u The object to transfer ownership from, which owns a
259 * convertible pointer to a non-array object.
261 * Invokes the deleter first if this object owns a pointer.
263 template<typename _Up
, typename _Ep
>
264 typename enable_if
< __and_
<
265 __safe_conversion_up
<_Up
, _Ep
>,
266 is_assignable
<deleter_type
&, _Ep
&&>
269 operator=(unique_ptr
<_Up
, _Ep
>&& __u
) noexcept
271 reset(__u
.release());
272 get_deleter() = std::forward
<_Ep
>(__u
.get_deleter());
276 /// Reset the %unique_ptr to empty, invoking the deleter if necessary.
278 operator=(nullptr_t
) noexcept
286 /// Dereference the stored pointer.
287 typename add_lvalue_reference
<element_type
>::type
290 __glibcxx_assert(get() != pointer());
294 /// Return the stored pointer.
296 operator->() const noexcept
298 _GLIBCXX_DEBUG_PEDASSERT(get() != pointer());
302 /// Return the stored pointer.
305 { return std::get
<0>(_M_t
); }
307 /// Return a reference to the stored deleter.
309 get_deleter() noexcept
310 { return std::get
<1>(_M_t
); }
312 /// Return a reference to the stored deleter.
314 get_deleter() const noexcept
315 { return std::get
<1>(_M_t
); }
317 /// Return @c true if the stored pointer is not null.
318 explicit operator bool() const noexcept
319 { return get() == pointer() ? false : true; }
323 /// Release ownership of any stored pointer.
328 std::get
<0>(_M_t
) = pointer();
332 /** @brief Replace the stored pointer.
334 * @param __p The new pointer to store.
336 * The deleter will be invoked if a pointer is already owned.
339 reset(pointer __p
= pointer()) noexcept
342 swap(std::get
<0>(_M_t
), __p
);
343 if (__p
!= pointer())
347 /// Exchange the pointer and deleter with another object.
349 swap(unique_ptr
& __u
) noexcept
352 swap(_M_t
, __u
._M_t
);
355 // Disable copy from lvalue.
356 unique_ptr(const unique_ptr
&) = delete;
357 unique_ptr
& operator=(const unique_ptr
&) = delete;
360 /// 20.7.1.3 unique_ptr for array objects with a runtime length
361 // [unique.ptr.runtime]
362 // _GLIBCXX_RESOLVE_LIB_DEFECTS
363 // DR 740 - omit specialization for array objects with a compile time length
364 template<typename _Tp
, typename _Dp
>
365 class unique_ptr
<_Tp
[], _Dp
>
367 // use SFINAE to determine whether _Del::pointer exists
370 template<typename _Up
>
371 static typename
_Up::pointer
__test(typename
_Up::pointer
*);
373 template<typename _Up
>
374 static _Tp
* __test(...);
376 typedef typename remove_reference
<_Dp
>::type _Del
;
379 typedef decltype(__test
<_Del
>(0)) type
;
382 typedef std::tuple
<typename
_Pointer::type
, _Dp
> __tuple_type
;
385 template<typename _Up
>
386 using __remove_cv
= typename remove_cv
<_Up
>::type
;
388 // like is_base_of<_Tp, _Up> but false if unqualified types are the same
389 template<typename _Up
>
390 using __is_derived_Tp
391 = __and_
< is_base_of
<_Tp
, _Up
>,
392 __not_
<is_same
<__remove_cv
<_Tp
>, __remove_cv
<_Up
>>> >;
396 typedef typename
_Pointer::type pointer
;
397 typedef _Tp element_type
;
398 typedef _Dp deleter_type
;
400 // helper template for detecting a safe conversion from another
402 template<typename _Up
, typename _Ep
,
403 typename _Up_up
= unique_ptr
<_Up
, _Ep
>,
404 typename _Up_element_type
= typename
_Up_up::element_type
>
405 using __safe_conversion_up
= __and_
<
407 is_same
<pointer
, element_type
*>,
408 is_same
<typename
_Up_up::pointer
, _Up_element_type
*>,
409 is_convertible
<_Up_element_type(*)[], element_type(*)[]>,
410 __or_
<__and_
<is_reference
<deleter_type
>, is_same
<deleter_type
, _Ep
>>,
411 __and_
<__not_
<is_reference
<deleter_type
>>,
412 is_convertible
<_Ep
, deleter_type
>>>
415 // helper template for detecting a safe conversion from a raw pointer
416 template<typename _Up
>
417 using __safe_conversion_raw
= __and_
<
418 __or_
<__or_
<is_same
<_Up
, pointer
>,
419 is_same
<_Up
, nullptr_t
>>,
420 __and_
<is_pointer
<_Up
>,
421 is_same
<pointer
, element_type
*>,
423 typename remove_pointer
<_Up
>::type(*)[],
431 /// Default constructor, creates a unique_ptr that owns nothing.
432 constexpr unique_ptr() noexcept
434 { static_assert(!std::is_pointer
<deleter_type
>::value
,
435 "constructed with null function pointer deleter"); }
437 /** Takes ownership of a pointer.
439 * @param __p A pointer to an array of a type safely convertible
440 * to an array of @c element_type
442 * The deleter will be value-initialized.
444 template<typename _Up
,
445 typename
= typename enable_if
<
446 __safe_conversion_raw
<_Up
>::value
, bool>::type
>
448 unique_ptr(_Up __p
) noexcept
449 : _M_t(__p
, deleter_type())
450 { static_assert(!is_pointer
<deleter_type
>::value
,
451 "constructed with null function pointer deleter"); }
453 /** Takes ownership of a pointer.
455 * @param __p A pointer to an array of a type safely convertible
456 * to an array of @c element_type
457 * @param __d A reference to a deleter.
459 * The deleter will be initialized with @p __d
461 template<typename _Up
,
462 typename
= typename enable_if
<
463 __safe_conversion_raw
<_Up
>::value
, bool>::type
>
465 typename conditional
<is_reference
<deleter_type
>::value
,
466 deleter_type
, const deleter_type
&>::type __d
) noexcept
469 /** Takes ownership of a pointer.
471 * @param __p A pointer to an array of a type safely convertible
472 * to an array of @c element_type
473 * @param __d A reference to a deleter.
475 * The deleter will be initialized with @p std::move(__d)
477 template<typename _Up
,
478 typename
= typename enable_if
<
479 __safe_conversion_raw
<_Up
>::value
, bool>::type
>
480 unique_ptr(_Up __p
, typename
481 remove_reference
<deleter_type
>::type
&& __d
) noexcept
482 : _M_t(std::move(__p
), std::move(__d
))
483 { static_assert(!is_reference
<deleter_type
>::value
,
484 "rvalue deleter bound to reference"); }
486 /// Move constructor.
487 unique_ptr(unique_ptr
&& __u
) noexcept
488 : _M_t(__u
.release(), std::forward
<deleter_type
>(__u
.get_deleter())) { }
490 /// Creates a unique_ptr that owns nothing.
491 constexpr unique_ptr(nullptr_t
) noexcept
: unique_ptr() { }
493 template<typename _Up
, typename _Ep
,
494 typename
= _Require
<__safe_conversion_up
<_Up
, _Ep
>>>
495 unique_ptr(unique_ptr
<_Up
, _Ep
>&& __u
) noexcept
496 : _M_t(__u
.release(), std::forward
<_Ep
>(__u
.get_deleter()))
499 /// Destructor, invokes the deleter if the stored pointer is not null.
502 auto& __ptr
= std::get
<0>(_M_t
);
503 if (__ptr
!= nullptr)
504 get_deleter()(__ptr
);
510 /** @brief Move assignment operator.
512 * @param __u The object to transfer ownership from.
514 * Invokes the deleter first if this object owns a pointer.
517 operator=(unique_ptr
&& __u
) noexcept
519 reset(__u
.release());
520 get_deleter() = std::forward
<deleter_type
>(__u
.get_deleter());
524 /** @brief Assignment from another type.
526 * @param __u The object to transfer ownership from, which owns a
527 * convertible pointer to an array object.
529 * Invokes the deleter first if this object owns a pointer.
531 template<typename _Up
, typename _Ep
>
533 enable_if
<__and_
<__safe_conversion_up
<_Up
, _Ep
>,
534 is_assignable
<deleter_type
&, _Ep
&&>
537 operator=(unique_ptr
<_Up
, _Ep
>&& __u
) noexcept
539 reset(__u
.release());
540 get_deleter() = std::forward
<_Ep
>(__u
.get_deleter());
544 /// Reset the %unique_ptr to empty, invoking the deleter if necessary.
546 operator=(nullptr_t
) noexcept
554 /// Access an element of owned array.
555 typename
std::add_lvalue_reference
<element_type
>::type
556 operator[](size_t __i
) const
558 __glibcxx_assert(get() != pointer());
562 /// Return the stored pointer.
565 { return std::get
<0>(_M_t
); }
567 /// Return a reference to the stored deleter.
569 get_deleter() noexcept
570 { return std::get
<1>(_M_t
); }
572 /// Return a reference to the stored deleter.
574 get_deleter() const noexcept
575 { return std::get
<1>(_M_t
); }
577 /// Return @c true if the stored pointer is not null.
578 explicit operator bool() const noexcept
579 { return get() == pointer() ? false : true; }
583 /// Release ownership of any stored pointer.
588 std::get
<0>(_M_t
) = pointer();
592 /** @brief Replace the stored pointer.
594 * @param __p The new pointer to store.
596 * The deleter will be invoked if a pointer is already owned.
598 template <typename _Up
,
600 __or_
<is_same
<_Up
, pointer
>,
601 __and_
<is_same
<pointer
, element_type
*>,
604 typename remove_pointer
<_Up
>::type(*)[],
611 reset(_Up __p
) noexcept
614 swap(std::get
<0>(_M_t
), __p
);
619 void reset(nullptr_t
= nullptr) noexcept
624 /// Exchange the pointer and deleter with another object.
626 swap(unique_ptr
& __u
) noexcept
629 swap(_M_t
, __u
._M_t
);
632 // Disable copy from lvalue.
633 unique_ptr(const unique_ptr
&) = delete;
634 unique_ptr
& operator=(const unique_ptr
&) = delete;
637 template<typename _Tp
, typename _Dp
>
639 swap(unique_ptr
<_Tp
, _Dp
>& __x
,
640 unique_ptr
<_Tp
, _Dp
>& __y
) noexcept
643 template<typename _Tp
, typename _Dp
,
644 typename _Up
, typename _Ep
>
646 operator==(const unique_ptr
<_Tp
, _Dp
>& __x
,
647 const unique_ptr
<_Up
, _Ep
>& __y
)
648 { return __x
.get() == __y
.get(); }
650 template<typename _Tp
, typename _Dp
>
652 operator==(const unique_ptr
<_Tp
, _Dp
>& __x
, nullptr_t
) noexcept
655 template<typename _Tp
, typename _Dp
>
657 operator==(nullptr_t
, const unique_ptr
<_Tp
, _Dp
>& __x
) noexcept
660 template<typename _Tp
, typename _Dp
,
661 typename _Up
, typename _Ep
>
663 operator!=(const unique_ptr
<_Tp
, _Dp
>& __x
,
664 const unique_ptr
<_Up
, _Ep
>& __y
)
665 { return __x
.get() != __y
.get(); }
667 template<typename _Tp
, typename _Dp
>
669 operator!=(const unique_ptr
<_Tp
, _Dp
>& __x
, nullptr_t
) noexcept
670 { return (bool)__x
; }
672 template<typename _Tp
, typename _Dp
>
674 operator!=(nullptr_t
, const unique_ptr
<_Tp
, _Dp
>& __x
) noexcept
675 { return (bool)__x
; }
677 template<typename _Tp
, typename _Dp
,
678 typename _Up
, typename _Ep
>
680 operator<(const unique_ptr
<_Tp
, _Dp
>& __x
,
681 const unique_ptr
<_Up
, _Ep
>& __y
)
684 std::common_type
<typename unique_ptr
<_Tp
, _Dp
>::pointer
,
685 typename unique_ptr
<_Up
, _Ep
>::pointer
>::type _CT
;
686 return std::less
<_CT
>()(__x
.get(), __y
.get());
689 template<typename _Tp
, typename _Dp
>
691 operator<(const unique_ptr
<_Tp
, _Dp
>& __x
, nullptr_t
)
692 { return std::less
<typename unique_ptr
<_Tp
, _Dp
>::pointer
>()(__x
.get(),
695 template<typename _Tp
, typename _Dp
>
697 operator<(nullptr_t
, const unique_ptr
<_Tp
, _Dp
>& __x
)
698 { return std::less
<typename unique_ptr
<_Tp
, _Dp
>::pointer
>()(nullptr,
701 template<typename _Tp
, typename _Dp
,
702 typename _Up
, typename _Ep
>
704 operator<=(const unique_ptr
<_Tp
, _Dp
>& __x
,
705 const unique_ptr
<_Up
, _Ep
>& __y
)
706 { return !(__y
< __x
); }
708 template<typename _Tp
, typename _Dp
>
710 operator<=(const unique_ptr
<_Tp
, _Dp
>& __x
, nullptr_t
)
711 { return !(nullptr < __x
); }
713 template<typename _Tp
, typename _Dp
>
715 operator<=(nullptr_t
, const unique_ptr
<_Tp
, _Dp
>& __x
)
716 { return !(__x
< nullptr); }
718 template<typename _Tp
, typename _Dp
,
719 typename _Up
, typename _Ep
>
721 operator>(const unique_ptr
<_Tp
, _Dp
>& __x
,
722 const unique_ptr
<_Up
, _Ep
>& __y
)
723 { return (__y
< __x
); }
725 template<typename _Tp
, typename _Dp
>
727 operator>(const unique_ptr
<_Tp
, _Dp
>& __x
, nullptr_t
)
728 { return std::less
<typename unique_ptr
<_Tp
, _Dp
>::pointer
>()(nullptr,
731 template<typename _Tp
, typename _Dp
>
733 operator>(nullptr_t
, const unique_ptr
<_Tp
, _Dp
>& __x
)
734 { return std::less
<typename unique_ptr
<_Tp
, _Dp
>::pointer
>()(__x
.get(),
737 template<typename _Tp
, typename _Dp
,
738 typename _Up
, typename _Ep
>
740 operator>=(const unique_ptr
<_Tp
, _Dp
>& __x
,
741 const unique_ptr
<_Up
, _Ep
>& __y
)
742 { return !(__x
< __y
); }
744 template<typename _Tp
, typename _Dp
>
746 operator>=(const unique_ptr
<_Tp
, _Dp
>& __x
, nullptr_t
)
747 { return !(__x
< nullptr); }
749 template<typename _Tp
, typename _Dp
>
751 operator>=(nullptr_t
, const unique_ptr
<_Tp
, _Dp
>& __x
)
752 { return !(nullptr < __x
); }
754 /// std::hash specialization for unique_ptr.
755 template<typename _Tp
, typename _Dp
>
756 struct hash
<unique_ptr
<_Tp
, _Dp
>>
757 : public __hash_base
<size_t, unique_ptr
<_Tp
, _Dp
>>
760 operator()(const unique_ptr
<_Tp
, _Dp
>& __u
) const noexcept
762 typedef unique_ptr
<_Tp
, _Dp
> _UP
;
763 return std::hash
<typename
_UP::pointer
>()(__u
.get());
767 #if __cplusplus > 201103L
769 #define __cpp_lib_make_unique 201304
771 template<typename _Tp
>
773 { typedef unique_ptr
<_Tp
> __single_object
; };
775 template<typename _Tp
>
776 struct _MakeUniq
<_Tp
[]>
777 { typedef unique_ptr
<_Tp
[]> __array
; };
779 template<typename _Tp
, size_t _Bound
>
780 struct _MakeUniq
<_Tp
[_Bound
]>
781 { struct __invalid_type
{ }; };
783 /// std::make_unique for single objects
784 template<typename _Tp
, typename
... _Args
>
785 inline typename _MakeUniq
<_Tp
>::__single_object
786 make_unique(_Args
&&... __args
)
787 { return unique_ptr
<_Tp
>(new _Tp(std::forward
<_Args
>(__args
)...)); }
789 /// std::make_unique for arrays of unknown bound
790 template<typename _Tp
>
791 inline typename _MakeUniq
<_Tp
>::__array
792 make_unique(size_t __num
)
793 { return unique_ptr
<_Tp
>(new remove_extent_t
<_Tp
>[__num
]()); }
795 /// Disable std::make_unique for arrays of known bound
796 template<typename _Tp
, typename
... _Args
>
797 inline typename _MakeUniq
<_Tp
>::__invalid_type
798 make_unique(_Args
&&...) = delete;
801 // @} group pointer_abstractions
803 _GLIBCXX_END_NAMESPACE_VERSION
806 #endif /* _UNIQUE_PTR_H */