#pragma once
#ifndef _MEMORY_
#define _MEMORY_
#ifndef RC_INVOKED
#include <xmemory>
#include <exception>
#include <typeinfo>
#include <type_traits>
#pragma pack(push,_CRT_PACKING)
#pragma warning(push,_STL_WARNING_LEVEL)
#pragma warning(disable: _STL_DISABLED_WARNINGS)
#pragma warning(disable:
4455
4494
4619
4643
4702
4984
4988
)
_STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new
template
<
class
,
class
>
inline
_Uninitialized_copy_unchecked
(
,
const
,
const
,
_General_ptr_iterator_tag
)
{
<
>
{
};
for
(;
!=
; ++
)
{
_Backout
.
(*
);
}
return
(
_Backout
.
());
}
template
<
class
,
class
>
inline
_Uninitialized_copy_unchecked
(
const
,
const
,
const
,
_Really_trivial_ptr_iterator_tag
)
{
return
(
(
,
,
));
}
template
<
class
,
class
>
inline
(
const
,
const
,
)
{
(
,
);
const
auto
=
(
);
const
auto
=
(
);
const
auto
=
(
,
<
>(
_UFirst
,
_ULast
));
(
,
_Uninitialized_copy_unchecked
(
_UFirst
,
_ULast
,
_UDest
,
(
_UFirst
,
_UDest
)));
return
(
);
}
#if _ITERATOR_DEBUG_ARRAY_OVERLOADS
template
<
class
,
class
,
>
inline
*
(
const
,
const
,
(&
)[
])
{
return (_STD uninitialized_copy(_First, _Last, _Array_iterator<_OutTy, _OutSize>(_Dest))._Unwrapped());
return
(::
std
::
(
,
,
<
,
>(
))._Unwrapped());
}
#endif /* _ITERATOR_DEBUG_ARRAY_OVERLOADS */
template
<
class
,
class
,
class
>
inline
_Uninitialized_copy_n_unchecked2
(
,
,
const
,
_General_ptr_iterator_tag
)
{
<
>
{
};
for
(;
0
<
; --
, (
void
)++
)
{
_Backout
.
(*
);
}
return
(
_Backout
.
());
}
template
<
class
,
class
,
class
>
inline
_Uninitialized_copy_n_unchecked2
(
const
,
const
,
const
,
_Really_trivial_ptr_iterator_tag
)
{
return
(
(
,
+
,
));
}
template
<
class
,
class
,
class
>
inline
(
const
,
const
,
)
{
<
>
=
;
if
(
0
_Count
)
{
const
auto
=
(
,
_Count
);
const
auto
=
(
,
_Count
);
(
,
_Uninitialized_copy_n_unchecked2
(
_UFirst
,
_Count
,
_UDest
,
(
_UFirst
,
_UDest
)));
}
return
(
);
}
#if _ITERATOR_DEBUG_ARRAY_OVERLOADS
template
<
class
,
,
class
,
class
>
inline
(
(&
)[
],
const
,
)
{
<
>
=
;
if
(
0
_Count
)
{
_STL_VERIFY_ARRAY_SIZE(_First, _Count);
do
{
if
((::
std
::
(
) >=
static_cast
<
<
,
decltype
(
_Count
)>>(
_Count
))) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
119
,
0
,
"%s"
,
"array too small"
)) || (__debugbreak(),
0
)); ::
(
L"\"array too small\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
119
,
0
); }
while
(
false
); } ; }
while
(
false
);
const
auto
=
(
,
_Count
);
(
,
_Uninitialized_copy_n_unchecked2
(
,
_Count
,
_UDest
,
(
,
_UDest
)));
}
return
(
);
}
template
<
class
,
class
,
class
,
>
inline
*
(
const
,
const
,
(&
)[
])
{
<
>
=
;
if
(
0
_Count
)
{
_STL_VERIFY_ARRAY_SIZE(_Dest, _Count);
do
{
if
((::
std
::
(
) >=
static_cast
<
<
,
decltype
(
_Count
)>>(
_Count
))) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
137
,
0
,
"%s"
,
"array too small"
)) || (__debugbreak(),
0
)); ::
(
L"\"array too small\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
137
,
0
); }
while
(
false
); } ; }
while
(
false
);
const
auto
=
(
,
_Count
);
return
(
_Uninitialized_copy_n_unchecked2
(
_UFirst
,
_Count
,
,
(
_UFirst
,
)));
}
return
(
);
}
template
<
class
,
,
class
,
class
,
>
inline
*
(
(&
)[
],
const
,
(&
)[
])
{
<
>
=
;
if
(
0
_Count
)
{
_STL_VERIFY_ARRAY_SIZE(_First, _Count);
do
{
if
((::
std
::
(
) >=
static_cast
<
<
,
decltype
(
_Count
)>>(
_Count
))) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
155
,
0
,
"%s"
,
"array too small"
)) || (__debugbreak(),
0
)); ::
(
L"\"array too small\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
155
,
0
); }
while
(
false
); } ; }
while
(
false
);
_STL_VERIFY_ARRAY_SIZE(_Dest, _Count);
do
{
if
((::
std
::
(
) >=
static_cast
<
<
,
decltype
(
_Count
)>>(
_Count
))) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
156
,
0
,
"%s"
,
"array too small"
)) || (__debugbreak(),
0
)); ::
(
L"\"array too small\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
156
,
0
); }
while
(
false
); } ; }
while
(
false
);
return
(
_Uninitialized_copy_n_unchecked2
(
,
_Count
,
,
(
,
)));
}
return
(
);
}
#endif /* _ITERATOR_DEBUG_ARRAY_OVERLOADS */
#if _HAS_CXX17
// FUNCTION TEMPLATE uninitialized_move
template<class _InIt,
class _FwdIt> inline
_FwdIt uninitialized_move(const _InIt _First, const _InIt _Last, _FwdIt _Dest)
{ // move [_First, _Last) to raw [_Dest, ...)
_Adl_verify_range(_First, _Last);
const auto _UFirst = _Get_unwrapped(_First);
const auto _ULast = _Get_unwrapped(_Last);
const auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast));
_Seek_wrapped(_Dest,
_Uninitialized_move_unchecked(_UFirst, _ULast, _UDest));
return (_Dest);
}
#if _ITERATOR_DEBUG_ARRAY_OVERLOADS
template<class _InIt,
class _OutTy,
size_t _OutSize> inline
_OutTy * uninitialized_move(const _InIt _First, const _InIt _Last, _OutTy (&_Dest)[_OutSize])
{ // move [_First, _Last) to raw [_Dest, ...)
return (_STD uninitialized_move(_First, _Last, _Array_iterator<_OutTy, _OutSize>(_Dest))._Unwrapped());
}
#endif /* _ITERATOR_DEBUG_ARRAY_OVERLOADS */
// FUNCTION TEMPLATE uninitialized_move_n
template<class _InIt,
class _Diff,
class _FwdIt> inline
pair<_InIt, _FwdIt> _Uninitialized_move_n_unchecked1(_InIt _First, _Diff _Count,
const _FwdIt _Dest, _General_ptr_iterator_tag)
{ // move [_First, _First + _Count) to [_Dest, ...), no special optimization
_Uninitialized_backout<_FwdIt> _Backout{_Dest};
for (; 0 < _Count; --_Count, (void)++_First)
{
_Backout._Emplace_back(_STD move(*_First));
}
return (pair<_InIt, _FwdIt>(_First, _Backout._Release()));
}
template<class _InIt,
class _Diff,
class _FwdIt> inline
pair<_InIt, _FwdIt> _Uninitialized_move_n_unchecked1(_InIt _First, _Diff _Count,
_FwdIt _Dest, _Really_trivial_ptr_iterator_tag)
{ // move [_First, _First + _Count) to [_Dest, ...), memmove optimization
if (0 < _Count)
{
_Dest = _Copy_memmove(_First, _First + _Count, _Dest);
_First += _Count;
}
return (pair<_InIt, _FwdIt>(_First, _Dest));
}
template<class _InIt,
class _Diff,
class _FwdIt> inline
pair<_InIt, _FwdIt> _Uninitialized_move_n_unchecked(const _InIt _First, const _Diff _Count, const _FwdIt _Dest)
{ // move [_First, _First + _Count) to [_Dest, ...), choose optimization
return (_Uninitialized_move_n_unchecked1(_First, _Count,
_Dest, _Ptr_move_cat(_First, _Dest)));
}
template<class _InIt,
class _Diff,
class _FwdIt> inline
pair<_InIt, _FwdIt> uninitialized_move_n(_InIt _First, const _Diff _Count_raw, _FwdIt _Dest)
{ // move [_First, _First + _Count) to [_Dest, ...)
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (0 < _Count)
{
const auto _Result = _Uninitialized_move_n_unchecked(
_Get_unwrapped_n(_First, _Count), _Count, _Get_unwrapped_n(_Dest, _Count));
_Seek_wrapped(_Dest, _Result.second);
_Seek_wrapped(_First, _Result.first);
}
return {_First, _Dest};
}
#if _ITERATOR_DEBUG_ARRAY_OVERLOADS
template<class _InTy,
size_t _InSize,
class _Diff,
class _FwdIt> inline
pair<_InTy *, _FwdIt> uninitialized_move_n(_InTy (&_First)[_InSize], const _Diff _Count_raw, _FwdIt _Dest)
{ // move [_First, _First + _Count) to [_Dest, ...), array input
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (0 < _Count)
{
_STL_VERIFY_ARRAY_SIZE(_First, _Count);
const auto _Result = _Uninitialized_move_n_unchecked(_First, _Count, _Get_unwrapped_n(_Dest, _Count));
_Seek_wrapped(_Dest, _Result.second);
return {_Result.first, _Dest};
}
return {_First, _Dest};
}
template<class _InIt,
class _Diff,
class _OutTy,
size_t _OutSize> inline
pair<_InIt, _OutTy *> uninitialized_move_n(_InIt _First, const _Diff _Count_raw, _OutTy (&_Dest)[_OutSize])
{ // move [_First, _First + _Count) to [_Dest, ...), array dest
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (0 < _Count)
{
_STL_VERIFY_ARRAY_SIZE(_Dest, _Count);
const auto _Result = _Uninitialized_move_n_unchecked(_Get_unwrapped_n(_First, _Count), _Count, _Dest);
_Seek_wrapped(_First, _Result.first);
return {_First, _Result.second};
}
return {_First, _Dest};
}
template<class _InTy,
size_t _InSize,
class _Diff,
class _OutTy,
size_t _OutSize> inline
pair<_InTy *, _OutTy *> uninitialized_move_n(_InTy (&_First)[_InSize], const _Diff _Count_raw,
_OutTy (&_Dest)[_OutSize])
{ // move [_First, _First + _Count) to [_Dest, ...), array input/dest
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (0 < _Count)
{
_STL_VERIFY_ARRAY_SIZE(_First, _Count);
_STL_VERIFY_ARRAY_SIZE(_Dest, _Count);
return (_Uninitialized_move_n_unchecked(_First, _Count, _Dest));
}
return {_First, _Dest};
}
#endif /* _ITERATOR_DEBUG_ARRAY_OVERLOADS */
#endif /* _HAS_CXX17 */
template
<
class
,
class
>
inline
void
_Uninitialized_fill_unchecked
(
const
,
const
,
const
&
,
)
{
<
>
{
};
while
(
_Backout
.
!=
)
{
_Backout
.
(
);
}
_Backout
.
();
}
template
<
class
,
class
>
inline
void
_Uninitialized_fill_unchecked
(
const
,
const
,
const
&
,
)
{
_CSTD memset(_First, static_cast<unsigned char>(_Val), static_cast<size_t>(_Last - _First));
::
(
,
static_cast
<
unsigned
char
>(
),
static_cast
<
>(
-
));
}
template
<
class
,
class
>
inline
void
(
const
,
const
,
const
&
)
{
(
,
);
const
auto
=
(
);
_Uninitialized_fill_unchecked
(
_UFirst
,
(
),
,
(
_UFirst
,
));
}
template
<
class
,
class
,
class
>
inline
_Uninitialized_fill_n_unchecked1
(
const
,
,
const
&
,
)
{
<
>
{
};
for
(;
0
<
; --
)
{
_Backout
.
(
);
}
return
(
_Backout
.
());
}
template
<
class
,
class
,
class
>
inline
_Uninitialized_fill_n_unchecked1
(
const
,
const
,
const
&
,
)
{
_CSTD memset(_First, static_cast<unsigned char>(_Val), _Count);
::
(
,
static_cast
<
unsigned
char
>(
),
);
return
(
+
);
}
template
<
class
,
class
,
class
>
inline
(
,
const
,
const
&
)
{
<
>
=
;
if
(
0
_Count
)
{
const
auto
=
(
,
_Count
);
(
,
_Uninitialized_fill_n_unchecked1
(
_UFirst
,
_Count
,
,
(
_UFirst
,
)));
}
return
(
);
}
#if _HAS_CXX17
// FUNCTION TEMPLATE destroy_at
template<class _Ty> inline
void destroy_at(_Ty * const _Location)
{ // destroy _Ty at memory address _Location
_Location->~_Ty();
}
// FUNCTION TEMPLATE destroy
template<class _FwdIt> inline
void destroy(const _FwdIt _First, const _FwdIt _Last)
{ // destroy all elements in [_First, _Last)
_Adl_verify_range(_First, _Last);
_Destroy_range(_Get_unwrapped(_First), _Get_unwrapped(_Last));
}
// FUNCTION TEMPLATE destroy_n
template<class _FwdIt,
class _Diff> inline
_FwdIt _Destroy_n1(_FwdIt _First, _Diff _Count, false_type)
{ // destroy [_First, _First + _Count), no special optimization
for (; 0 < _Count; ++_First, (void)--_Count)
{
_Destroy_in_place(*_First);
}
return (_First);
}
template<class _FwdIt,
class _Diff> inline
_FwdIt _Destroy_n1(const _FwdIt _First, const _Diff _Count, true_type)
{ // destroy [_First, _First + _Count), trivially destructible
return (_STD next(_First, _Count)); // nothing to do
}
template<class _FwdIt,
class _Diff> inline
_FwdIt destroy_n(_FwdIt _First, const _Diff _Count_raw)
{ // destroy all elements in [_First, _First + _Count)
const _Algorithm_int_t<_Diff> _Count = _Count_raw;
if (0 < _Count)
{
const auto _UFirst = _Get_unwrapped_n(_First, _Count);
_Seek_wrapped(_First, _Destroy_n1(_UFirst, _Count,
is_trivially_destructible<_Iter_value_t<_FwdIt>>()));
}
return (_First);
}
// FUNCTION TEMPLATE uninitialized_default_construct
template<class _FwdIt> inline
void _Uninitialized_default_construct_unchecked(const _FwdIt _First, const _FwdIt _Last, false_type)
{ // default-initialize all elements in [_First, _Last), no special optimization
_Uninitialized_backout<_FwdIt> _Backout{_First};
for (; _Backout._Last != _Last; ++_Backout._Last)
{
::new (static_cast<void *>(_Unfancy(_Backout._Last))) _Iter_value_t<_FwdIt>;
}
_Backout._Release();
}
template<class _FwdIt> inline
void _Uninitialized_default_construct_unchecked(_FwdIt, _FwdIt, true_type)
{ // default-initialize all elements in [_First, _Last), trivially default constructible types
// nothing to do
}
template<class _FwdIt> inline
void uninitialized_default_construct(const _FwdIt _First, const _FwdIt _Last)
{ // default-initialize all elements in [_First, _Last)
_Adl_verify_range(_First, _Last);
_Uninitialized_default_construct_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last),
is_trivially_default_constructible<_Iter_value_t<_FwdIt>>());
}
// FUNCTION TEMPLATE uninitialized_default_construct_n
template<class _FwdIt,
class _Diff> inline
_FwdIt _Uninitialized_default_construct_n_unchecked(const _FwdIt _First, _Diff _Count, false_type)
{ // default-initialize all elements in [_First, _First + _Count), no special optimization
_Uninitialized_backout<_FwdIt> _Backout{_First};
for (; 0 < _Count; ++_Backout._Last, (void)--_Count)
{
::new (static_cast<void *>(_Unfancy(_Backout._Last))) _Iter_value_t<_FwdIt>;
}
return (_Backout._Release());
}
template<class _FwdIt,
class _Diff> inline
_FwdIt _Uninitialized_default_construct_n_unchecked(const _FwdIt _First, const _Diff _Count, true_type)
{ // default-initialize all elements in [_First, _First + _Count), trivially default constructible types
// nothing to do
return (_STD next(_First, _Count));
}
template<class _FwdIt,
class _Diff> inline
_FwdIt uninitialized_default_construct_n(_FwdIt _First, const _Diff _Count_raw)
{ // default-initialize all elements in [_First, _First + _Count_raw)
const _Algorithm_int_t<_Diff> _Count = _Count_raw;
if (0 < _Count)
{
const auto _UFirst = _Get_unwrapped_n(_First, _Count);
_Seek_wrapped(_First,
_Uninitialized_default_construct_n_unchecked(_UFirst, _Count,
is_trivially_default_constructible<_Iter_value_t<_FwdIt>>()));
}
return (_First);
}
// FUNCTION TEMPLATE uninitialized_value_construct
template<class _FwdIt> inline
void _Uninitialized_value_construct_unchecked(const _FwdIt _First, const _FwdIt _Last, false_type)
{ // value-initialize all elements in [_First, _Last), no special optimization
_Uninitialized_backout<_FwdIt> _Backout{_First};
while (_Backout._Last != _Last)
{
_Backout._Emplace_back();
}
_Backout._Release();
}
template<class _FwdIt> inline
void _Uninitialized_value_construct_unchecked(const _FwdIt _First, const _FwdIt _Last, true_type)
{ // value-initialize all elements in [_First, _Last), all-bits-zero type
_Zero_range(_First, _Last);
}
template<class _FwdIt> inline
void uninitialized_value_construct(const _FwdIt _First, const _FwdIt _Last)
{ // value-initialize all elements in [_First, _Last)
_Adl_verify_range(_First, _Last);
const auto _UFirst = _Get_unwrapped(_First);
const auto _ULast = _Get_unwrapped(_Last);
_Uninitialized_value_construct_unchecked(_UFirst, _ULast,
_Use_memset_value_construct_t<_Unwrapped_t<_FwdIt>>());
}
// FUNCTION TEMPLATE uninitialized_value_construct_n
// TRANSITION: _Uninitialized_value_construct_n_unchecked is an ABI zombie name
template<class _FwdIt,
class _Diff> inline
_FwdIt _Uninitialized_value_construct_n_unchecked1(const _FwdIt _First, _Diff _Count, false_type)
{ // value-initialize all elements in [_First, _First + _Count), no special optimization
_Uninitialized_backout<_FwdIt> _Backout{_First};
for (; 0 < _Count; --_Count)
{
_Backout._Emplace_back();
}
return (_Backout._Release());
}
template<class _FwdIt,
class _Diff> inline
_FwdIt _Uninitialized_value_construct_n_unchecked1(const _FwdIt _First, const _Diff _Count, true_type)
{ // value-initialize all elements in [_First, _First + _Count), all-bits-zero type
return (_Zero_range(_First, _First + _Count));
}
template<class _FwdIt,
class _Diff> inline
_FwdIt uninitialized_value_construct_n(_FwdIt _First, const _Diff _Count_raw)
{ // value-initialize all elements in [_First, _First + _Count_raw)
const _Algorithm_int_t<_Diff> _Count = _Count_raw;
if (0 < _Count)
{
const auto _UFirst = _Get_unwrapped_n(_First, _Count);
_Seek_wrapped(_First,
_Uninitialized_value_construct_n_unchecked1(_UFirst, _Count,
_Use_memset_value_construct_t<_Unwrapped_n_t<_FwdIt>>()));
}
return (_First);
}
#endif /* _HAS_CXX17 */
template
<
class
,
class
>
class _CXX17_DEPRECATE_RAW_STORAGE_ITERATOR raw_storage_iterator
{
public
:
using
=
;
using
=
void
;
using
=
void
;
using
=
void
;
using
=
void
;
explicit
(
)
: _Next(
)
{
}
_NODISCARD raw_storage_iterator& operator*()
{
return
(*
this
);
}
&
(
const
&
)
{
(*
,
);
return
(*
this
);
}
&
(
&&
)
{
_Construct_in_place(*_Next, _STD move(_Val));
return
(*
this
);
}
&
()
{
++
;
return
(*
this
);
}
(
int
)
{
= *
this
;
++
;
return
(
_Ans
);
}
_NODISCARD _OutIt base() const
{
return
(
);
}
private
:
;
};
#if _HAS_AUTO_PTR_ETC
template
<
class
>
class
;
template
<
class
>
struct
{
explicit
(
*
)
: _Ref(
)
{
}
*
;
};
template
<
class
>
class
{
public
:
typedef
;
explicit
(
*
=
nullptr
)
noexcept
: _Myptr(
)
{
}
(
&
)
noexcept
: _Myptr(
.
())
{
}
(
<
>
)
noexcept
{
*
=
.
;
.
=
nullptr
;
=
_Ptr
;
}
template
<
class
>
<
>()
noexcept
{
return
(
<
>(*
this
));
}
template
<
class
>
<
>()
noexcept
{
*
=
;
<
>
(
_Cvtptr
);
=
nullptr
;
return
(
_Ans
);
}
template
<
class
>
&
(
<
>&
)
noexcept
{
(
.
());
return
(*
this
);
}
template
<
class
>
(
<
>&
)
noexcept
: _Myptr(
.
())
{
}
&
(
&
)
noexcept
{
(
.
());
return
(*
this
);
}
&
(
<
>
)
noexcept
{
*
=
.
;
.
=
0
;
(
_Ptr
);
return
(*
this
);
}
()
noexcept
{
delete
;
}
_NODISCARD _Ty& operator*() const noexcept
{
#if _ITERATOR_DEBUG_LEVEL == 2
_STL_VERIFY(_Myptr, "auto_ptr not dereferencable");
#endif /* _ITERATOR_DEBUG_LEVEL == 2 */
do
{
if
(
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
709
,
0
,
"%s"
,
"auto_ptr not dereferencable"
)) || (__debugbreak(),
0
)); ::
(
L"\"auto_ptr not dereferencable\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
709
,
0
); }
while
(
false
); } ; }
while
(
false
);
return
(*
());
}
_NODISCARD _Ty * operator->() const noexcept
{
#if _ITERATOR_DEBUG_LEVEL == 2
_STL_VERIFY(_Myptr, "auto_ptr not dereferencable");
#endif /* _ITERATOR_DEBUG_LEVEL == 2 */
do
{
if
(
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
718
,
0
,
"%s"
,
"auto_ptr not dereferencable"
)) || (__debugbreak(),
0
)); ::
(
L"\"auto_ptr not dereferencable\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\memory"
,
718
,
0
); }
while
(
false
); } ; }
while
(
false
);
return
(
());
}
_NODISCARD _Ty * get() const noexcept
{
return
(
);
}
*
()
noexcept
{
*
=
;
=
nullptr
;
return
(
_Tmp
);
}
void
(
*
=
nullptr
)
{
if
(
)
delete
;
=
;
}
private
:
*
;
};
template
<>
class
<
void
>
{
public
:
typedef
void
;
};
#endif /* _HAS_AUTO_PTR_ETC */
class
:
public
{
public
:
()
noexcept
{
}
_NODISCARD virtual const char * __CLR_OR_THIS_CALL what() const noexcept override
virtual
const
char
*
()
const
noexcept
override
{
return
(
"bad_weak_ptr"
);
}
};
class
__declspec
(novtable)
{
private
:
#ifdef _M_CEE_PURE
virtual void _Destroy() noexcept
{ // permanent workaround to avoid mentioning _purecall in msvcurt.lib, ptrustu.lib, or other support libs
_STD terminate();
}
virtual void _Delete_this() noexcept
{ // permanent workaround to avoid mentioning _purecall in msvcurt.lib, ptrustu.lib, or other support libs
_STD terminate();
}
#else /* ^^^ _M_CEE_PURE ^^^ // vvv !_M_CEE_PURE vvv */
virtual
void
()
noexcept
=
0
;
virtual
void
()
noexcept
=
0
;
#endif /* _M_CEE_PURE */
;
;
protected
:
()
: _Uses(
1
), _Weaks(
1
)
{
}
public
:
virtual
()
noexcept
{
}
bool
()
{
for
(;;)
{
#if _USE_INTERLOCKED_REFCOUNTING
const
=
static_cast
<
volatile
&>(
);
if
(
_Count
0
)
return
(
false
);
if
(
static_cast
<
>(
_InterlockedCompareExchange
(
reinterpret_cast
<
volatile
long
*>(&
),
static_cast
<
long
>(
_Count
+
1
),
static_cast
<
long
>(
_Count
)))
_Count
)
return
(
true
);
#else /* _USE_INTERLOCKED_REFCOUNTING */
const _Atomic_integral_t _Count =
_Load_atomic_counter(_Uses);
if (_Count == 0)
return (false);
if (_Compare_increment_atomic_counter(_Uses, _Count))
return (true);
#endif /* _USE_INTERLOCKED_REFCOUNTING */
}
}
void
()
{
_MT_INCR(_Uses);
(
reinterpret_cast
<
volatile
long
*>(&
));
}
void
()
{
_MT_INCR(_Weaks);
(
reinterpret_cast
<
volatile
long
*>(&
));
}
void
()
{
if (_MT_DECR(_Uses) == 0)
if
(
(
reinterpret_cast
<
volatile
long
*>(&
))
0
)
{
();
();
}
}
void
()
{
if (_MT_DECR(_Weaks) == 0)
if
(
(
reinterpret_cast
<
volatile
long
*>(&
))
0
)
{
();
}
}
long
()
const
noexcept
{
return
(
static_cast
<
long
>(
(
)));
}
virtual
void
*
(
const
&)
const
noexcept
{
return
(
nullptr
);
}
};
template
<
class
>
class
:
public
{
public
:
explicit
(
*
)
:
(), _Ptr(
)
{
}
private
:
virtual
void
()
noexcept
override
{
delete
;
}
virtual
void
()
noexcept
override
{
delete
this
;
}
*
;
};
template
<
class
,
class
>
class
:
public
{
public
:
(
,
)
: _Ref_count_base(), _Mypair(_One_then_variadic_args_t(), _STD move(_Dt), _Px)
:
(), _Mypair(
_One_then_variadic_args_t
(), ::
std
::
(
),
)
{
}
virtual
void
*
(
const
&
)
const
noexcept
override
{
#if _HAS_STATIC_RTTI
if
(
typeid
(
))
{
return (const_cast<_Dx *>(_STD addressof(_Mypair._Get_first())));
return
(
const_cast
<
*>(::
std
::
(
.
())));
}
#else /* _HAS_STATIC_RTTI */
(void)_Typeid;
#endif /* _HAS_STATIC_RTTI */
return
(
nullptr
);
}
private
:
virtual
void
()
noexcept
override
{
.
()(
.
());
}
virtual
void
()
noexcept
override
{
delete
this
;
}
<
,
>
;
};
template
<
class
,
class
,
class
>
class
_Ref_count_resource_alloc
:
public
{
public
:
_Ref_count_resource_alloc
(
,
,
const
&
)
: _Ref_count_base(), _Mypair(_One_then_variadic_args_t(), _STD move(_Dt),
:
(), _Mypair(
_One_then_variadic_args_t
(), ::
std
::
(
),
_One_then_variadic_args_t
(),
,
)
{
}
virtual
void
*
(
const
&
)
const
noexcept
override
{
#if _HAS_STATIC_RTTI
if
(
typeid
(
))
{
return (const_cast<_Dx *>(_STD addressof(_Mypair._Get_first())));
return
(
const_cast
<
*>(::
std
::
(
.
())));
}
#else /* _HAS_STATIC_RTTI */
(void)_Typeid;
#endif /* _HAS_STATIC_RTTI */
return
(
nullptr
);
}
private
:
using
=
<
,
_Ref_count_resource_alloc
>;
virtual
void
()
noexcept
override
{
.
()(
.
().
());
}
virtual
void
()
noexcept
override
{
=
.
().
();
<
>::
(
_Al
,
this
);
(
_Al
,
this
);
}
<
,
<
,
>>
;
};
template
<
class
>
struct
;
template
<
class
,
class
=
<
>>
class
;
template
<
class
>
class
;
template
<
class
>
class
;
template
<
class
,
class
=
void
>
struct
:
{
};
template
<
class
>
struct
<
,
<
typename
::_Esft_type>>
:
<
<
> *,
typename
::_Esft_type *>::
{
};
template
<
class
,
class
>
void
_Enable_shared_from_this1
(
const
<
>&
,
*
,
)
{
if
(
&&
->_Wptr.expired())
{
->_Wptr =
<
<
>>(
,
const_cast
<
<
> *>(
));
}
}
template
<
class
,
class
>
void
_Enable_shared_from_this1
(
const
<
>&,
*,
)
{
}
template
<
class
,
class
>
void
(
const
<
>&
,
*
)
{
_Enable_shared_from_this1
(
,
,
<
<
<
<
>>,
<
<
>>,
<
>>>{});
}
template
<
class
>
class
{
public
:
using
=
<
>;
_NODISCARD long use_count() const noexcept
{
return
(
?
->
() :
0
);
}
template
<
class
>
_NODISCARD bool owner_before(const _Ptr_base<_Ty2>& _Right) const noexcept
bool
(
const
<
>&
)
const
noexcept
{
return
(
.
);
}
(
const
&) =
delete
;
&
(
const
&) =
delete
;
protected
:
_NODISCARD element_type * get() const noexcept
{
return
(
);
}
constexpr
()
noexcept
=
default
;
() =
default
;
template
<
class
>
void
(
<
>&&
)
{
=
.
;
=
.
;
.
=
nullptr
;
.
=
nullptr
;
}
template
<
class
>
void
(
const
<
>&
)
{
if
(
.
)
{
.
->
();
}
=
.
;
=
.
;
}
template
<
class
>
void
(
const
<
>&
,
*
)
{
if
(
.
)
{
.
->
();
}
=
;
=
.
;
}
template
<
class
_Ty0>
friend
class
;
template
<
class
>
bool
(
const
<
>&
)
{
if
(
.
&&
.
->
())
{
=
.
;
=
.
;
return
(
true
);
}
return
(
false
);
}
void
()
{
if
(
)
{
->
();
}
}
void
(
&
)
noexcept
{
_STD swap(_Ptr, _Right._Ptr);
_STD swap(_Rep, _Right._Rep);
}
void
(
*
,
*
)
{
=
;
=
;
}
template
<
class
>
void
(
const
<
>&
)
{
if
(
.
)
{
.
->
();
}
=
.
;
=
.
;
}
void
()
{
if
(
)
{
->
();
}
}
private
:
*
{
nullptr
};
*
{
nullptr
};
template
<
class
_Ty0>
friend
class
;
#if _HAS_STATIC_RTTI
template
<
class
,
class
>
friend
*
(
const
<
>&
)
noexcept
;
#endif /* _HAS_STATIC_RTTI */
};
template
<
class
,
class
=
void
>
struct
:
{};
template
<
class
>
struct _Can_scalar_delete<_Yty, void_t<decltype(delete _STD declval<_Yty *>())>>
struct
<
,
<
decltype
(
delete
::
std
::
<
*>())>>
:
{};
template
<
class
,
class
=
void
>
struct
:
{};
template
<
class
>
struct _Can_array_delete<_Yty, void_t<decltype(delete[] _STD declval<_Yty *>())>>
struct
<
,
<
decltype
(
delete
[] ::
std
::
<
*>())>>
:
{};
template
<
class
,
class
,
class
=
void
>
struct
_Can_call_function_object
:
{};
template
<
class
,
class
>
struct _Can_call_function_object<_Fx, _Arg, void_t<decltype(_STD declval<_Fx>()(_STD declval<_Arg>()))>>
struct
_Can_call_function_object
<
,
,
<
decltype
(::
std
::
<
>()(::
std
::
<
>()))>>
:
{};
template
<
class
,
class
>
struct
:
<
*,
*>::
{};
template
<
class
,
class
>
struct
<
,
[]>
:
<
(*)[],
(*)[]>::
{};
template
<
class
,
class
,
>
struct
<
,
[
]>
:
<
(*)[
],
(*)[
]>::
{};
template
<
class
,
class
>
struct
:
<
*,
*>::
{
};
template
<
class
,
>
struct
<
[
],
[]>
:
{
};
template
<
class
,
>
struct
<
[
],
const
[]>
:
{
};
template
<
class
,
>
struct
<
[
],
volatile
[]>
:
{
};
template
<
class
,
>
struct
<
[
],
const
volatile
[]>
:
{
};
template
<
class
>
class
:
public
<
>
{
private
:
using
=
<
>;
public
:
using
typename
::
;
#if _HAS_CXX17
using weak_type = weak_ptr<_Ty>;
#endif /* _HAS_CXX17 */
constexpr
()
noexcept
{
}
constexpr
(
)
noexcept
{
}
template
<
class
,
<
<
<
<
>,
<
>,
<
>>,
<
,
>>,
int
> =
0
>
explicit
(
*
)
{
(
,
<
>{});
}
template
<
class
,
class
,
<
<
<
>,
_Can_call_function_object
<
&,
*&>,
<
,
>>,
int
> =
0
>
(
*
,
)
{
_Setpd(_Px, _STD move(_Dt));
}
template
<
class
,
class
,
class
,
<
<
<
>,
_Can_call_function_object
<
&,
*&>,
<
,
>>,
int
> =
0
>
(
*
,
,
)
{
_Setpda(_Px, _STD move(_Dt), _Ax);
}
template
<
class
,
<
<
<
>,
_Can_call_function_object
<
&,
&>
>,
int
> =
0
>
(
,
)
{
_Setpd(nullptr, _STD move(_Dt));
}
template
<
class
,
class
,
<
<
<
>,
_Can_call_function_object
<
&,
&>
>,
int
> =
0
>
(
,
,
)
{
_Setpda(nullptr, _STD move(_Dt), _Ax);
}
template
<
class
>
(
const
<
>&
,
*
)
noexcept
{
this
->
(
,
);
}
(
const
&
)
noexcept
{
this
->
(
);
}
template
<
class
,
<
<
,
>::
,
int
> =
0
>
(
const
<
>&
)
noexcept
{
this
->
(
);
}
(
&&
)
noexcept
{
this->_Move_construct_from(_STD move(_Right));
}
template
<
class
,
<
<
,
>::
,
int
> =
0
>
(
<
>&&
)
noexcept
{
this->_Move_construct_from(_STD move(_Right));
}
template
<
class
,
<
<
,
>::
,
int
> =
0
>
explicit
(
const
<
>&
)
{
if
(!
this
->
(
))
{
}
}
#if _HAS_AUTO_PTR_ETC
template
<
class
,
<
<
*,
*>,
int
> =
0
>
(
<
>&&
)
{
*
=
.
();
_Set_ptr_rep_and_enable_shared
(
_Px
,
new
<
>(
_Px
));
.
();
}
#endif /* _HAS_AUTO_PTR_ETC */
template
<
class
,
class
,
<
<
<
,
>,
<
typename
<
,
>::pointer,
*>
>,
int
> =
0
>
(
<
,
>&&
)
{
using
=
typename
<
,
>::
;
using
=
typename
<
,
>::
*;
using _Deleter_t = conditional_t<is_reference_v<_Dx>, decltype(_STD ref(_Other.get_deleter())), _Dx>;
using
=
<
<
>,
decltype
(::
std
::
(
.
())),
>;
const
=
.
();
if
(
_Fancy
)
{
const
=
_Fancy
;
const
auto
=
new
<
,
>(
_Fancy
,
.
());
_Set_ptr_rep_and_enable_shared
(
_Raw
,
_Rx
);
.
();
}
}
()
noexcept
{
this
->
();
}
&
(
const
&
)
noexcept
{
(
).
(*
this
);
return
(*
this
);
}
template
<
class
>
&
(
const
<
>&
)
noexcept
{
(
).
(*
this
);
return
(*
this
);
}
&
(
&&
)
noexcept
{
shared_ptr(_STD move(_Right)).swap(*this);
return
(*
this
);
}
template
<
class
>
&
(
<
>&&
)
noexcept
{
shared_ptr(_STD move(_Right)).swap(*this);
return
(*
this
);
}
#if _HAS_AUTO_PTR_ETC
template
<
class
>
&
(
<
>&&
)
{
shared_ptr(_STD move(_Right)).swap(*this);
return
(*
this
);
}
#endif /* _HAS_AUTO_PTR_ETC */
template
<
class
,
class
>
&
(
<
,
>&&
)
{
shared_ptr(_STD move(_Right)).swap(*this);
return
(*
this
);
}
void
(
&
)
noexcept
{
this
->
(
);
}
void
()
noexcept
{
().
(*
this
);
}
template
<
class
>
void
(
*
)
{
(
).
(*
this
);
}
template
<
class
,
class
>
void
(
*
,
)
{
(
,
).
(*
this
);
}
template
<
class
,
class
,
class
>
void
(
*
,
,
)
{
(
,
,
).
(*
this
);
}
using
::
;
template
<
class
=
,
<!
<
<
>,
<
>>,
int
> =
0
>
_NODISCARD _Ty2& operator*() const noexcept
{
return
(*
());
}
template
<
class
=
,
<!
<
>,
int
> =
0
>
_NODISCARD _Ty2 * operator->() const noexcept
{
return
(
());
}
template
<
class
=
,
class
=
,
<
<
>,
int
> =
0
>
_NODISCARD _Elem& operator[](ptrdiff_t _Idx) const
{
return
(
()[
]);
}
_NODISCARD _CXX17_DEPRECATE_SHARED_PTR_UNIQUE bool unique() const noexcept
{
return
(
this
->
()
1
);
}
explicit
bool
()
const
noexcept
{
return
(
() !=
nullptr
);
}
private
:
template
<
class
>
void
(
*
,
)
{
(
,
<
[]>{});
}
template
<
class
>
void
(
*
,
)
{
_TRY_BEGIN // allocate control block and set
_Set_ptr_rep_and_enable_shared
(
,
new
<
>(
));
_CATCH_ALL // allocation failed, delete resource
delete
;
}
template
<
class
,
class
>
void
(
,
)
{
_TRY_BEGIN // allocate control block and set
_Set_ptr_rep_and_enable_shared(_Px, new _Ref_count_resource<_UxptrOrNullptr, _Dx>(_Px, _STD move(_Dt)));
_Set_ptr_rep_and_enable_shared
(
,
new
<
,
>(
, ::
std
::
(
)));
_CATCH_ALL // allocation failed, delete resource
(
);
}
template
<
class
,
class
,
class
>
void
(
,
,
)
{
using
=
_Ref_count_resource_alloc
<
,
,
>;
using
=
<
,
>;
using
=
<
>;
(
);
_TRY_BEGIN // allocate control block and set
const
auto
=
::
(
_Alref
,
1
);
*
const
=
(
_Pfancy
);
_Alref_traits::construct(_Alref, _Pref, _Px, _STD move(_Dt), _Ax);
::
(
_Alref
,
_Pref
,
, ::
std
::
(
),
);
_Set_ptr_rep_and_enable_shared
(
,
_Pref
);
::
(
_Alref
,
_Pfancy
,
1
);
_CATCH_ALL // allocation failed, delete resource
(
);
}
template
<
class
,
class
...
>
friend
<
>
(
&&...
);
template
<
class
,
class
,
class
...
>
friend
<
>
(
const
&
,
&&...
);
template
<
class
>
void
_Set_ptr_rep_and_enable_shared
(
*
,
*
)
{
this
->
(
,
);
(*
this
,
);
}
void
_Set_ptr_rep_and_enable_shared
(
,
*
)
{
this
->
(
nullptr
,
);
}
};
#if _HAS_CXX17
template<class _Ty>
shared_ptr(weak_ptr<_Ty>) -> shared_ptr<_Ty>;
template<class _Ty,
class _Dx>
shared_ptr(unique_ptr<_Ty, _Dx>) -> shared_ptr<_Ty>;
#endif /* _HAS_CXX17 */
template
<
class
,
class
>
_NODISCARD bool operator==(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept
bool
(
const
<
>&
,
const
<
>&
)
noexcept
{
return
(
.
()
.
());
}
template
<
class
,
class
>
_NODISCARD bool operator!=(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept
bool
(
const
<
>&
,
const
<
>&
)
noexcept
{
return
(
.
()
.
());
}
template
<
class
,
class
>
_NODISCARD bool operator<(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept
bool
(
const
<
>&
,
const
<
>&
)
noexcept
{
return
(
.
()
.
());
}
template
<
class
,
class
>
_NODISCARD bool operator>=(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept
bool
(
const
<
>&
,
const
<
>&
)
noexcept
{
return
(
.
() >=
.
());
}
template
<
class
,
class
>
_NODISCARD bool operator>(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept
bool
(
const
<
>&
,
const
<
>&
)
noexcept
{
return
(
.
() >
.
());
}
template
<
class
,
class
>
_NODISCARD bool operator<=(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept
bool
(
const
<
>&
,
const
<
>&
)
noexcept
{
return
(
.
() <=
.
());
}
template
<
class
>
_NODISCARD bool operator==(const shared_ptr<_Ty>& _Left, nullptr_t) noexcept
bool
(
const
<
>&
,
)
noexcept
{
return
(
.
() ==
nullptr
);
}
template
<
class
>
_NODISCARD bool operator==(nullptr_t, const shared_ptr<_Ty>& _Right) noexcept
bool
(
,
const
<
>&
)
noexcept
{
return
(
nullptr
==
.
());
}
template
<
class
>
_NODISCARD bool operator!=(const shared_ptr<_Ty>& _Left, nullptr_t) noexcept
bool
(
const
<
>&
,
)
noexcept
{
return
(
.
() !=
nullptr
);
}
template
<
class
>
_NODISCARD bool operator!=(nullptr_t, const shared_ptr<_Ty>& _Right) noexcept
bool
(
,
const
<
>&
)
noexcept
{
return
(
nullptr
!=
.
());
}
template
<
class
>
_NODISCARD bool operator<(const shared_ptr<_Ty>& _Left, nullptr_t) noexcept
bool
(
const
<
>&
,
)
noexcept
{
return
(
.
()
static_cast
<
typename
<
>::
*>(
nullptr
));
}
template
<
class
>
_NODISCARD bool operator<(nullptr_t, const shared_ptr<_Ty>& _Right) noexcept
bool
(
,
const
<
>&
)
noexcept
{
return
(
static_cast
<
typename
<
>::
*>(
nullptr
)
.
());
}
template
<
class
>
_NODISCARD bool operator>=(const shared_ptr<_Ty>& _Left, nullptr_t) noexcept
bool
(
const
<
>&
,
)
noexcept
{
return
(
.
() >=
static_cast
<
typename
<
>::
*>(
nullptr
));
}
template
<
class
>
_NODISCARD bool operator>=(nullptr_t, const shared_ptr<_Ty>& _Right) noexcept
bool
(
,
const
<
>&
)
noexcept
{
return
(
static_cast
<
typename
<
>::
*>(
nullptr
) >=
.
());
}
template
<
class
>
_NODISCARD bool operator>(const shared_ptr<_Ty>& _Left, nullptr_t) noexcept
bool
(
const
<
>&
,
)
noexcept
{
return
(
.
() >
static_cast
<
typename
<
>::
*>(
nullptr
));
}
template
<
class
>
_NODISCARD bool operator>(nullptr_t, const shared_ptr<_Ty>& _Right) noexcept
bool
(
,
const
<
>&
)
noexcept
{
return
(
static_cast
<
typename
<
>::
*>(
nullptr
) >
.
());
}
template
<
class
>
_NODISCARD bool operator<=(const shared_ptr<_Ty>& _Left, nullptr_t) noexcept
bool
(
const
<
>&
,
)
noexcept
{
return
(
.
() <=
static_cast
<
typename
<
>::
*>(
nullptr
));
}
template
<
class
>
_NODISCARD bool operator<=(nullptr_t, const shared_ptr<_Ty>& _Right) noexcept
bool
(
,
const
<
>&
)
noexcept
{
return
(
static_cast
<
typename
<
>::
*>(
nullptr
) <=
.
());
}
template
<
class
,
class
,
class
>
<
,
>&
(
<
,
>&
,
const
<
>&
)
{
return
(
.
());
}
template
<
class
>
void
(
<
>&
,
<
>&
)
noexcept
{
.
(
);
}
template
<
class
,
class
>
_NODISCARD shared_ptr<_Ty1> static_pointer_cast(const shared_ptr<_Ty2>& _Other) noexcept
{
const
auto
=
static_cast
<
typename
<
>::
*>(
.
());
return
(
<
>(
,
_Ptr
));
}
template
<
class
,
class
>
_NODISCARD shared_ptr<_Ty1> const_pointer_cast(const shared_ptr<_Ty2>& _Other) noexcept
{
const
auto
=
const_cast
<
typename
<
>::
*>(
.
());
return
(
<
>(
,
_Ptr
));
}
template
<
class
,
class
>
_NODISCARD shared_ptr<_Ty1> reinterpret_pointer_cast(const shared_ptr<_Ty2>& _Other) noexcept
{
const
auto
=
reinterpret_cast
<
typename
<
>::
*>(
.
());
return
(
<
>(
,
_Ptr
));
}
#ifdef _CPPRTTI
template
<
class
,
class
>
_NODISCARD shared_ptr<_Ty1> dynamic_pointer_cast(const shared_ptr<_Ty2>& _Other) noexcept
{
const
auto
=
dynamic_cast
<
typename
<
>::
*>(
.
());
if
(
_Ptr
)
{
return
(
<
>(
,
_Ptr
));
}
return
(
<
>());
}
#else /* _CPPRTTI */
template<class _Ty1,
class _Ty2>
shared_ptr<_Ty1> dynamic_pointer_cast(const shared_ptr<_Ty2>&) noexcept = delete; // requires /GR option
#endif /* _CPPRTTI */
#if _HAS_STATIC_RTTI
template
<
class
,
class
>
_NODISCARD _Dx * get_deleter(const shared_ptr<_Ty>& _Sx) noexcept
{
if
(
.
)
{
return
(
static_cast
<
*>(
.
->
(
typeid
(
))));
}
return
(
nullptr
);
}
#else /* _HAS_STATIC_RTTI */
template<class _Dx,
class _Ty>
_Dx * get_deleter(const shared_ptr<_Ty>&) noexcept = delete; // requires static RTTI
#endif /* _HAS_STATIC_RTTI */
template
<
class
>
class
:
public
{
public
:
template
<
class
...
>
explicit
(
&&...
)
:
()
{
::new (static_cast<void *>(&_Storage)) _Ty(_STD forward<_Types>(_Args)...);
::
new
(
static_cast
<
void
*>(&
))
(::
std
::
<
>(
)...);
}
*
()
{
return
(
reinterpret_cast
<
*>(&
));
}
private
:
virtual
void
()
noexcept
override
{
()->~_Ty();
}
virtual
void
()
noexcept
override
{
delete
this
;
}
<
1
,
>
;
};
template
<
class
,
class
>
class
:
public
{
public
:
template
<
class
...
>
explicit
(
const
&
,
&&...
)
:
(), _Mypair(
_One_then_variadic_args_t
(),
)
{
::new (static_cast<void *>(&_Mypair._Get_second())) _Ty(_STD forward<_Types>(_Args)...);
::
new
(
static_cast
<
void
*>(&
.
()))
(::
std
::
<
>(
)...);
}
*
()
{
return
(
reinterpret_cast
<
*>(&
.
()));
}
private
:
using
=
<
,
>;
using
=
<
1
,
>;
virtual
void
()
noexcept
override
{
()->~_Ty();
}
virtual
void
()
noexcept
override
{
=
.
();
<
>::
(
_Al
,
this
);
(
_Al
,
this
);
}
<
,
>
;
};
template
<
class
,
class
...
>
_NODISCARD inline shared_ptr<_Ty> make_shared(_Types&&... _Args)
{
const auto _Rx = new _Ref_count_obj<_Ty>(_STD forward<_Types>(_Args)...);
const
auto
=
new
<
>(::
std
::
<
>(
)...);
<
>
;
_Ret
.
_Set_ptr_rep_and_enable_shared
(
_Rx
->
(),
_Rx
);
return
(
_Ret
);
}
template
<
class
,
class
,
class
...
>
_NODISCARD inline shared_ptr<_Ty> allocate_shared(const _Alloc& _Al_arg, _Types&&... _Args)
inline
<
>
(
const
&
,
&&...
)
{
using
=
<
,
>;
using
=
<
,
>;
using
=
<
>;
(
);
const
auto
=
::
(
_Alref
,
1
);
_Alref_traits::construct(_Alref, _Unfancy(_Rx), _Al_arg, _STD forward<_Types>(_Args)...);
::
(
_Alref
,
(
_Rx
),
, ::
std
::
<
>(
)...);
::
(
_Alref
,
_Rx
,
1
);
<
>
;
_Ret
.
_Set_ptr_rep_and_enable_shared
(
_Rx
->
(),
(
_Rx
));
return
(
_Ret
);
}
template
<
class
>
class
:
public
<
>
{
public
:
constexpr
()
noexcept
{
}
(
const
&
)
noexcept
{
this
->
(
);
}
template
<
class
,
<
<
,
>::
,
int
> =
0
>
(
const
<
>&
)
noexcept
{
this
->
(
);
}
template
<
class
,
<
<
,
>::
,
int
> =
0
>
(
const
<
>&
)
noexcept
{
this
->
(
.
());
}
(
&&
)
noexcept
{
this->_Move_construct_from(_STD move(_Other));
}
template
<
class
,
<
<
,
>::
,
int
> =
0
>
(
<
>&&
)
noexcept
{
this
->
(
.
());
.
();
}
()
noexcept
{
this
->
();
}
&
(
const
&
)
noexcept
{
(
).
(*
this
);
return
(*
this
);
}
template
<
class
>
&
(
const
<
>&
)
noexcept
{
(
).
(*
this
);
return
(*
this
);
}
&
(
&&
)
noexcept
{
weak_ptr(_STD move(_Right)).swap(*this);
return
(*
this
);
}
template
<
class
>
&
(
<
>&&
)
noexcept
{
weak_ptr(_STD move(_Right)).swap(*this);
return
(*
this
);
}
template
<
class
>
&
(
const
<
>&
)
noexcept
{
(
).
(*
this
);
return
(*
this
);
}
void
()
noexcept
{
().
(*
this
);
}
void
(
&
)
noexcept
{
this
->
(
);
}
_NODISCARD bool expired() const noexcept
{
return
(
this
->
()
0
);
}
_NODISCARD shared_ptr<_Ty> lock() const noexcept
{
<
>
;
(
void
)
_Ret
.
(*
this
);
return
(
_Ret
);
}
};
#if _HAS_CXX17
template<class _Ty>
weak_ptr(shared_ptr<_Ty>) -> weak_ptr<_Ty>;
#endif /* _HAS_CXX17 */
template
<
class
>
void
(
<
>&
,
<
>&
)
noexcept
{
.
(
);
}
template
<
class
>
class
{
public
:
using
=
;
_NODISCARD shared_ptr<_Ty> shared_from_this()
{
return
(
<
>(
));
}
_NODISCARD shared_ptr<const _Ty> shared_from_this() const
{
return
(
<
const
>(
));
}
_NODISCARD weak_ptr<_Ty> weak_from_this() noexcept
{
return
(
);
}
_NODISCARD weak_ptr<const _Ty> weak_from_this() const noexcept
<
const
>
()
const
noexcept
{
return
(
);
}
protected
:
constexpr
()
noexcept
: _Wptr()
{
}
(
const
&)
noexcept
: _Wptr()
{
}
&
(
const
&)
noexcept
{
return
(*
this
);
}
() =
default
;
private
:
template
<
class
,
class
>
friend
void
_Enable_shared_from_this1
(
const
<
>&
,
*
,
);
mutable
<
>
;
};
template
<
class
>
struct
{
constexpr
()
noexcept
=
default
;
template
<
class
,
<
<
*,
*>,
int
> =
0
>
(
const
<
>&)
noexcept
{
}
void
(
*
)
const
noexcept
{
static_assert
(
0
sizeof
(
),
"can't delete an incomplete type"
);
delete
;
}
};
template
<
class
>
struct
<
[]>
{
constexpr
()
noexcept
=
default
;
template
<
class
,
<
<
(*)[],
(*)[]>,
int
> =
0
>
(
const
<
[]>&)
noexcept
{
}
template
<
class
,
<
<
(*)[],
(*)[]>,
int
> =
0
>
void
(
*
)
const
noexcept
{
static_assert
(
0
sizeof
(
),
"can't delete an incomplete type"
);
delete
[]
;
}
};
template
<
class
,
class
,
class
=
void
>
struct
_Get_deleter_pointer_type
{
typedef
*
;
};
template
<
class
,
class
>
struct
_Get_deleter_pointer_type
<
,
,
<
typename
::pointer>>
{
typedef
typename
::pointer
;
};
template
<
class
,
class
>
class
{
public
:
typedef
<
>
;
typedef
typename
_Get_deleter_pointer_type
<
,
>::
;
template
<
class
,
class
>
(
,
&&
)
: _Mypair(_One_then_variadic_args_t(), _STD forward<_Dx2>(_Dt), _Ptr)
: _Mypair(
_One_then_variadic_args_t
(), ::
std
::
<
>(
),
)
{
}
template
<
class
>
constexpr
(
)
: _Mypair(
_Zero_then_variadic_args_t
(),
)
{
}
_NODISCARD _Dx& get_deleter() noexcept
{
return
(
.
());
}
_NODISCARD const _Dx& get_deleter() const noexcept
const
&
()
const
noexcept
{
return
(
.
());
}
&
()
noexcept
{
return
(
.
());
}
const
&
()
const
noexcept
{
return
(
.
());
}
<
,
>
;
};
template
<
class
>
using
_Unique_ptr_enable_default_t
=
<
<
<
<
>>,
<
>>,
int
>;
template
<
class
,
class
>
class
:
public
<
,
>
{
public
:
typedef
<
,
>
;
typedef
typename
::
;
typedef
;
typedef
;
using
::
;
template
<
class
=
,
_Unique_ptr_enable_default_t
<
> =
0
>
constexpr
()
noexcept
:
(
())
{
}
template
<
class
=
,
_Unique_ptr_enable_default_t
<
> =
0
>
constexpr
(
)
noexcept
:
(
())
{
}
&
(
)
noexcept
{
();
return
(*
this
);
}
template
<
class
=
,
_Unique_ptr_enable_default_t
<
> =
0
>
explicit
(
)
noexcept
:
(
)
{
}
template
<
class
=
,
<
<
,
const
&>,
int
> =
0
>
(
,
const
&
)
noexcept
:
(
,
)
{
}
template
<
class
=
,
<
<
<
<
>>,
<
,
>>,
int
> =
0
>
(
,
&&
)
noexcept
: _Mybase(_Ptr, _STD move(_Dt))
{
}
template
<
class
=
,
<
<
<
>,
<
,
<
>>>,
int
> =
0
>
(
,
<
>&&) =
delete
;
(
&&
)
noexcept
:
(
.
(),
_STD forward<_Dx>(_Right.get_deleter()))
{
}
template
<
class
,
class
,
<
<
<
<
>>,
<
typename
<
,
>::
,
>,
<
<
>,
<
,
>,
<
,
>>
>,
int
> =
0
>
(
<
,
>&&
)
noexcept
:
(
.
(),
_STD forward<_Dx2>(_Right.get_deleter()))
{
}
#if _HAS_AUTO_PTR_ETC
template
<
class
,
<
<
<
*,
*>,
<
,
<
>>>,
int
> =
0
>
(
<
>&&
)
noexcept
:
(
.
())
{
}
#endif /* _HAS_AUTO_PTR_ETC */
template
<
class
,
class
,
<
<
<
<
>>,
<
&,
>,
<
typename
<
,
>::
,
>
>,
int
> =
0
>
&
(
<
,
>&&
)
noexcept
{
(
.
());
this->get_deleter() = _STD forward<_Dx2>(_Right.get_deleter());
this
->
() = ::
std
::
<
>(
.
());
return
(*
this
);
}
&
(
&&
)
noexcept
{
if (this != _STD addressof(_Right))
{
(
.
());
this->get_deleter() = _STD forward<_Dx>(_Right.get_deleter());
this
->
() = ::
std
::
<
>(
.
());
}
return
(*
this
);
}
void
(
&
)
noexcept
{
(
this
->
(),
.
());
(
this
->
(),
.
());
}
()
noexcept
{
if
(
()
())
{
this
->
()(
());
}
}
_NODISCARD add_lvalue_reference_t<_Ty> operator*() const
{
return
(*
());
}
_NODISCARD pointer operator->() const noexcept
{
return
(
this
->
());
}
_NODISCARD pointer get() const noexcept
{
return
(
this
->
());
}
explicit
bool
()
const
noexcept
{
return
(
()
());
}
()
noexcept
{
=
();
this
->
() =
();
return
(
_Ans
);
}
void
(
=
())
noexcept
{
=
();
this
->
() =
;
if
(
_Old
())
{
this
->
()(
_Old
);
}
}
(
const
&) =
delete
;
&
(
const
&) =
delete
;
};
template
<
class
,
class
>
class
<
[],
>
:
public
<
,
>
{
public
:
typedef
<
,
>
;
typedef
typename
::
;
typedef
;
typedef
;
using
::
;
template
<
class
=
,
_Unique_ptr_enable_default_t
<
> =
0
>
constexpr
()
noexcept
:
(
())
{
}
template
<
class
,
class
=
<
,
>>
using
=
<
<
,
>
||
::value
|| (
<
,
*>
&&
<
>
&&
<
<
>(*)[],
(*)[]
>)>;
template
<
class
,
class
=
,
_Unique_ptr_enable_default_t
<
> =
0
,
class
=
<
>>
explicit
(
)
noexcept
:
(
)
{
}
template
<
class
,
class
=
,
<
<
,
const
&>,
int
> =
0
,
class
=
<
>>
(
,
const
&
)
noexcept
:
(
,
)
{
}
template
<
class
,
class
=
,
<
<
<
<
>>,
<
,
>>,
int
> =
0
,
class
=
<
>>
(
,
&&
)
noexcept
: _Mybase(_Ptr, _STD move(_Dt))
{
}
template
<
class
,
class
=
,
<
<
<
>,
<
,
<
>>>,
int
> =
0
>
(
,
<
>&&) =
delete
;
(
&&
)
noexcept
:
(
.
(),
_STD forward<_Dx>(_Right.get_deleter()))
{
}
&
(
&&
)
noexcept
{
if (this != _STD addressof(_Right))
{
(
.
());
this->get_deleter() = _STD move(_Right.get_deleter());
this
->
() = ::
std
::
(
.
());
}
return
(*
this
);
}
template
<
class
,
class
,
class
,
class
=
typename
<
,
>::
,
class
=
typename
<
,
>::
>
using
=
<
<
<
>,
<
,
*>,
<
,
*>,
<
(*)[],
(*)[]>,
>>;
template
<
class
,
class
,
class
=
<
,
,
<
<
>,
<
,
>,
<
,
>>>>
(
<
,
>&&
)
noexcept
:
(
.
(),
_STD forward<_Ex>(_Right.get_deleter()))
{
}
template
<
class
,
class
,
class
=
<
,
,
<
&,
>>>
&
(
<
,
>&&
)
noexcept
{
(
.
());
this->get_deleter() = _STD forward<_Ex>(_Right.get_deleter());
this
->
() = ::
std
::
<
>(
.
());
return
(*
this
);
}
template
<
class
=
,
_Unique_ptr_enable_default_t
<
> =
0
>
constexpr
(
)
noexcept
:
(
())
{
}
&
(
)
noexcept
{
();
return
(*
this
);
}
void
(
=
nullptr
)
noexcept
{
(
());
}
void
(
&
)
noexcept
{
(
this
->
(),
.
());
(
this
->
(),
.
());
}
()
noexcept
{
();
}
_NODISCARD _Ty& operator[](size_t _Idx) const
{
return
(
()[
]);
}
_NODISCARD pointer get() const noexcept
{
return
(
this
->
());
}
explicit
bool
()
const
noexcept
{
return
(
()
());
}
()
noexcept
{
=
();
this
->
() =
();
return
(
_Ans
);
}
template
<
class
,
class
=
<
,
>>
void
(
)
noexcept
{
=
();
this
->
() =
;
if
(
_Old
())
{
this
->
()(
_Old
);
}
}
(
const
&) =
delete
;
&
(
const
&) =
delete
;
private
:
void
()
{
if
(
()
())
{
this
->
()(
());
}
}
};
template
<
class
,
class
...
,
<!
<
>,
int
> =
0
>
_NODISCARD inline unique_ptr<_Ty> make_unique(_Types&&... _Args)
{
return (unique_ptr<_Ty>(new _Ty(_STD forward<_Types>(_Args)...)));
return
(
<
>(
new
(::
std
::
<
>(
)...)));
}
template
<
class
,
<
<
> &&
<
> ==
0
,
int
> =
0
>
_NODISCARD inline unique_ptr<_Ty> make_unique(size_t _Size)
{
typedef
<
>
;
return
(
<
>(
new
[
]()));
}
template
<
class
,
class
...
,
<
<
> !=
0
,
int
> =
0
>
void
(
&&...) =
delete
;
template
<
class
>
struct
{
;
using
=
typename
<
>::
;
void
(
)
noexcept
{
<
>::
(
,
(
));
.deallocate(
,
1
);
}
};
template
<
class
>
using
=
<
typename
::value_type,
<
>>;
template
<
class
,
class
...
>
<
>
(
&
,
&&...
)
{
auto
=
.allocate(
1
);
allocator_traits<_Alloc>::construct(_Al, _Unfancy(_Ptr), _STD forward<_Args>(_Vals)...);
<
>::
(
,
(
_Ptr
), ::
std
::
<
>(
)...);
.deallocate(
_Ptr
,
1
);
return
(
<
>(
_Ptr
,
<
>{
}));
}
template
<
class
,
class
,
<
<
>::
,
int
> =
0
>
void
(
<
,
>&
,
<
,
>&
)
noexcept
{
.
(
);
}
template
<
class
,
class
,
class
,
class
>
_NODISCARD bool operator==(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right)
bool
(
const
<
,
>&
,
const
<
,
>&
)
{
return
(
.
()
.
());
}
template
<
class
,
class
,
class
,
class
>
_NODISCARD bool operator!=(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right)
bool
(
const
<
,
>&
,
const
<
,
>&
)
{
return
(!(
));
}
template
<
class
,
class
,
class
,
class
>
_NODISCARD bool operator<(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right)
bool
(
const
<
,
>&
,
const
<
,
>&
)
{
typedef
typename
<
,
>::
;
typedef
typename
<
,
>::
;
typedef
<
,
>
;
return
(
<
>()
.
(),
.
()));
}
template
<
class
,
class
,
class
,
class
>
_NODISCARD bool operator>=(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right)
bool
(
const
<
,
>&
,
const
<
,
>&
)
{
return
(!(
));
}
template
<
class
,
class
,
class
,
class
>
_NODISCARD bool operator>(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right)
bool
(
const
<
,
>&
,
const
<
,
>&
)
{
return
(
);
}
template
<
class
,
class
,
class
,
class
>
_NODISCARD bool operator<=(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right)
bool
(
const
<
,
>&
,
const
<
,
>&
)
{
return
(!(
));
}
template
<
class
,
class
>
_NODISCARD bool operator==(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t) noexcept
bool
(
const
<
,
>&
,
)
noexcept
{
return
(!
);
}
template
<
class
,
class
>
_NODISCARD bool operator==(nullptr_t, const unique_ptr<_Ty, _Dx>& _Right) noexcept
bool
(
,
const
<
,
>&
)
noexcept
{
return
(!
);
}
template
<
class
,
class
>
_NODISCARD bool operator!=(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right) noexcept
bool
(
const
<
,
>&
,
)
noexcept
{
return
(!(
));
}
template
<
class
,
class
>
_NODISCARD bool operator!=(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right) noexcept
bool
(
,
const
<
,
>&
)
noexcept
{
return
(!(
));
}
template
<
class
,
class
>
_NODISCARD bool operator<(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right)
{
typedef
typename
<
,
>::
;
return
(
<
>()
.
(),
));
}
template
<
class
,
class
>
_NODISCARD bool operator<(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right)
{
typedef
typename
<
,
>::
;
return
(
<
>()
,
.
()));
}
template
<
class
,
class
>
_NODISCARD bool operator>=(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right)
{
return
(!(
));
}
template
<
class
,
class
>
_NODISCARD bool operator>=(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right)
{
return
(!(
));
}
template
<
class
,
class
>
_NODISCARD bool operator>(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right)
{
return
(
);
}
template
<
class
,
class
>
_NODISCARD bool operator>(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right)
{
return
(
);
}
template
<
class
,
class
>
_NODISCARD bool operator<=(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right)
{
return
(!(
));
}
template
<
class
,
class
>
_NODISCARD bool operator<=(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right)
{
return
(!(
));
}
template
<
class
,
class
,
class
=
void
>
struct
:
{};
template
<
class
,
class
>
struct
<
,
,
<
decltype(_STD declval<_OutTy>() << _STD declval<_PxTy>().get())>>
decltype
(::
std
::
<
>() << ::
std
::
<
>().get())>>
:
{};
template
<
class
,
class
,
class
,
class
,
<
<
<
,
>&,
const
<
,
>&>::
,
int
> =
0
>
<
,
>&
(
<
,
>&
,
const
<
,
>&
)
{
.
();
return
(
);
}
enum
class
{
,
,
};
inline
void
(
void
*)
{
}
template
<
class
>
inline
*
(
*
)
{
return
(
);
}
inline
void
(
char
*,
)
{
}
inline
void
(
char
*,
)
{
}
inline
()
noexcept
{
return
(
::
);
}
template
<
class
=
void
>
struct
;
template
<
class
>
struct
<
<
>>
{
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef shared_ptr<_Ty> first_argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef shared_ptr<_Ty> second_argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef bool result_type;
_NODISCARD bool operator()(const shared_ptr<_Ty>& _Left, const shared_ptr<_Ty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
_NODISCARD bool operator()(const shared_ptr<_Ty>& _Left, const weak_ptr<_Ty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
_NODISCARD bool operator()(const weak_ptr<_Ty>& _Left, const shared_ptr<_Ty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
};
template
<
class
>
struct
<
<
>>
{
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef weak_ptr<_Ty> first_argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef weak_ptr<_Ty> second_argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef bool result_type;
_NODISCARD bool operator()(const weak_ptr<_Ty>& _Left, const weak_ptr<_Ty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
_NODISCARD bool operator()(const weak_ptr<_Ty>& _Left, const shared_ptr<_Ty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
_NODISCARD bool operator()(const shared_ptr<_Ty>& _Left, const weak_ptr<_Ty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
};
template
<>
struct
<
void
>
{
using
=
int
;
template
<
class
,
class
>
_NODISCARD bool operator()(const shared_ptr<_Ty>& _Left, const shared_ptr<_Uty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
template
<
class
,
class
>
_NODISCARD bool operator()(const shared_ptr<_Ty>& _Left, const weak_ptr<_Uty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
template
<
class
,
class
>
_NODISCARD bool operator()(const weak_ptr<_Ty>& _Left, const shared_ptr<_Uty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
template
<
class
,
class
>
_NODISCARD bool operator()(const weak_ptr<_Ty>& _Left, const weak_ptr<_Uty>& _Right) const noexcept
bool
(
const
<
>&
,
const
<
>&
)
const
noexcept
{
return
(
.
(
));
}
};
template
<
class
,
class
>
struct
<
<
,
>>
:
_Conditionally_enabled_hash
<
<
,
>,
is_default_constructible_v
<
<
typename
<
,
>::
>>>
{
static
(
const
<
,
>&
)
_NOEXCEPT_COND(_Is_nothrow_hashable<typename unique_ptr<_Ty, _Dx>::pointer>::value) // strengthened
noexcept
(
<
typename
<
,
>::
>::
)
{
return
(
<
typename
<
,
>::
>{}
.
()));
}
};
template
<
class
>
struct
<
<
>>
{
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef shared_ptr<_Ty> argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef size_t result_type;
_NODISCARD size_t operator()(const shared_ptr<_Ty>& _Keyval) const noexcept
(
const
<
>&
)
const
noexcept
{
return
(
<
typename
<
>::
*>()
.
()));
}
};
inline
void
*
(
,
,
void
*&
,
&
)
noexcept
{
=
static_cast
<
>(
reinterpret_cast
<
>(
) & (
-
1
));
if
(
_Off
0
)
{
_Off
=
-
_Off
;
}
if
(
_Off
||
-
_Off
)
{
return
(
nullptr
);
}
=
static_cast
<
char
*>(
) +
_Off
;
-=
_Off
;
return
(
);
}
_CRTIMP2_PURE void __cdecl _Lock_shared_ptr_spin_lock();
void
__cdecl
_Lock_shared_ptr_spin_lock
();
_CRTIMP2_PURE void __cdecl _Unlock_shared_ptr_spin_lock();
void
__cdecl
_Unlock_shared_ptr_spin_lock
();
struct
{
()
{
_Lock_shared_ptr_spin_lock
();
}
()
noexcept
{
_Unlock_shared_ptr_spin_lock
();
}
};
template
<
class
>
_NODISCARD inline bool atomic_is_lock_free(const shared_ptr<_Ty> *)
{
return
(
false
);
}
template
<
class
>
_NODISCARD inline shared_ptr<_Ty> atomic_load_explicit(const shared_ptr<_Ty> * _Ptr,
)
{
;
<
>
= *
;
return
(
_Result
);
}
template
<
class
>
_NODISCARD inline shared_ptr<_Ty> atomic_load(const shared_ptr<_Ty> * _Ptr)
{
return (_STD atomic_load_explicit(_Ptr, memory_order_seq_cst));
}
template
<
class
>
inline
void
(
<
> *
,
<
>
,
)
{
;
->
(
);
}
template
<
class
>
inline
void
(
<
> *
,
<
>
)
{
_STD atomic_store_explicit(_Ptr, _STD move(_Other), memory_order_seq_cst);
::
std
::
(
, ::
std
::
(
),
);
}
template
<
class
>
inline
<
>
(
<
> *
,
<
>
,
)
{
;
->
(
);
return
(
);
}
template
<
class
>
inline
<
>
(
<
> *
,
<
>
)
{
return (_STD atomic_exchange_explicit(_Ptr, _STD move(_Other), memory_order_seq_cst));
return
(::
std
::
(
, ::
std
::
(
),
));
}
template
<
class
>
inline
bool
atomic_compare_exchange_weak_explicit
(
<
> *
,
<
> *
,
<
>
,
,
)
{
<
>
;
;
bool
=
->
()
->
()
&& !
->
(*
)
&& !
->
(*
);
if
(
_Success
)
->
(
);
else
{
->
(
_Old_exp
);
*
*
;
}
return
(
_Success
);
}
template
<
class
>
inline
bool
atomic_compare_exchange_weak
(
<
> *
,
<
> *
,
<
>
)
{
return (_STD atomic_compare_exchange_weak_explicit(_Ptr, _Exp, _STD move(_Value),
return
(::
std
::
atomic_compare_exchange_weak_explicit
(
,
, ::
std
::
(
),
,
));
}
template
<
class
>
inline
bool
atomic_compare_exchange_strong_explicit
(
<
> *
,
<
> *
,
<
>
,
,
)
{
return (_STD atomic_compare_exchange_weak_explicit(_Ptr, _Exp, _STD move(_Value),
return
(::
std
::
atomic_compare_exchange_weak_explicit
(
,
, ::
std
::
(
),
,
));
}
template
<
class
>
inline
bool
atomic_compare_exchange_strong
(
<
> *
,
<
> *
,
<
>
)
{
return (_STD atomic_compare_exchange_strong_explicit(_Ptr, _Exp, _STD move(_Value),
return
(::
std
::
atomic_compare_exchange_strong_explicit
(
,
, ::
std
::
(
),
,
));
}
#if _HAS_TR1_NAMESPACE
namespace _DEPRECATE_TR1_NAMESPACE tr1 {
namespace
[[deprecated(
"warning STL4002: "
"The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED. You can "
"define _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING to acknowledge that you have received this warning."
)]]
{
using _STD allocate_shared;
using _STD const_pointer_cast;
using _STD dynamic_pointer_cast;
using _STD enable_shared_from_this;
using _STD static_pointer_cast;
}
#endif /* _HAS_TR1_NAMESPACE */
#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma warning(pop)
#pragma pack(pop)
#endif /* RC_INVOKED */
#endif /* _MEMORY_ */
#pragma pack(pop)