#pragma once
#ifndef _MAP_
#define _MAP_
#ifndef RC_INVOKED
#include <tuple>
#include <xtree>
#if _HAS_CXX17
#include <xpolymorphic_allocator.h>
#endif /* _HAS_CXX17 */
#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
,
class
,
class
,
bool
>
class
{
public
:
using
=
;
using
=
<
const
,
>;
using
=
;
using
=
;
#if _HAS_CXX17
using node_type = _Node_handle<
_Tree_node<value_type, typename allocator_traits<_Alloc>::void_pointer>,
_Alloc, _Node_handle_map_base, _Kty, _Ty>;
#endif /* _HAS_CXX17 */
enum
{
=
};
class
{
public
:
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef value_type first_argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef value_type second_argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef bool result_type;
bool
(
const
&
,
const
&
)
const
{
return
(
(
.
,
.
));
}
protected
:
friend
<
>;
(
)
: comp(
)
{
}
;
};
template
<
class
,
class
>
static
const
&
(
const
<
,
>&
)
{
return
(
.
);
}
};
template
<
class
,
class
,
class
=
<
>,
class
=
<
<
const
,
>>>
class
:
public
<
<
,
,
,
,
false
>>
{
public
:
static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<pair<const _Kty, _Ty>, typename _Alloc::value_type>,
static_assert
(!
0
||
<
<
const
,
>,
typename
::value_type>,
_MISMATCHED_ALLOCATOR_MESSAGE("map<Key, Value, Compare, Allocator>", "pair<const Key, Value>"));
"map<Key, Value, Compare, Allocator>"
" requires that Allocator's value_type match "
"pair<const Key, Value>"
" (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)"
" Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0"
" to suppress this diagnostic."
);
using
=
<
<
,
,
,
,
false
>>;
using
=
;
using
=
;
using
=
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
&;
using
=
const
&;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
#if _HAS_CXX17
using insert_return_type = _Insert_return_type<iterator, typename _Mybase::node_type>;
#endif /* _HAS_CXX17 */
()
:
(
())
{
}
explicit
(
const
&
)
:
(
(),
)
{
}
(
const
&
)
:
(
,
::
select_on_container_copy_construction
(
.
()))
{
}
(
const
&
,
const
&
)
:
(
,
)
{
}
explicit
(
const
&
)
:
(
)
{
}
(
const
&
,
const
&
)
:
(
,
)
{
}
template
<
class
>
(
,
)
:
(
())
{
(
,
);
}
template
<
class
>
(
,
,
const
&
)
:
(
)
{
(
,
);
}
template
<
class
>
(
,
,
const
&
)
:
(
(),
)
{
(
,
);
}
template
<
class
>
(
,
,
const
&
,
const
&
)
:
(
,
)
{
(
,
);
}
&
(
const
&
)
{
::
);
return
(*
this
);
}
(
&&
)
: _Mybase(_STD move(_Right))
{
}
(
&&
,
const
&
)
: _Mybase(_STD move(_Right), _Al)
{
}
&
(
&&
)
_NOEXCEPT_COND(_Alnode_traits::is_always_equal::value
&& is_nothrow_move_assignable_v<_Pr>)
noexcept
(
::
::
&&
is_nothrow_move_assignable_v
<
>)
{
_Mybase::operator=(_STD move(_Right));
return
(*
this
);
}
&
(
&&
)
{
return (try_emplace(_STD move(_Keyval)).first->second);
}
void swap(map& _Right) _NOEXCEPT_COND(_NOEXCEPT_OPER(_Mybase::swap(_Right))) // strengthened
void
(
&
)
noexcept
(
noexcept
(
::
(
)))
{
::
(
);
}
using
::
;
template
<
class
,
class
=
<
<
,
>>>
(
&&
)
{
return (this->emplace(_STD forward<_Valty>(_Val)));
return
(
this
->
(::
std
::
<
>(
)));
}
template
<
class
,
class
=
<
<
,
>>>
(
,
&&
)
{
return (this->emplace_hint(_Where, _STD forward<_Valty>(_Val)));
return
(
this
->
(
, ::
std
::
<
>(
)));
}
template
<
class
,
class
...
>
(
&&
,
&&...
)
{
=
::
(
);
if
(
_Where
::
()
|| _DEBUG_LT_PRED(_Mybase::_Getcomp(),
_Keyval, _Mybase::_Key(_Where._Ptr)))
||
(
::
(),
,
::
(
_Where
.
)))
return
(
(
::
(
_Where
,
piecewise_construct
,
_STD forward<_Keyty>(_Keyval)),
_STD forward<_Mappedty>(_Mapval)...)),
true
));
else
return
(
(
_Where
,
false
));
}
template
<
class
...
>
(
const
&
,
&&...
)
{
return (_Try_emplace(_Keyval, _STD forward<_Mappedty>(_Mapval)...));
return
(
(
, ::
std
::
<
>(
)...));
}
template
<
class
...
>
(
,
const
&
,
&&...
)
{
return
(
(
,
_STD forward<_Mappedty>(_Mapval)...).first);
}
template
<
class
...
>
(
&&
,
&&...
)
{
return (_Try_emplace(_STD move(_Keyval),
_STD forward<_Mappedty>(_Mapval)...));
}
template
<
class
...
>
(
,
&&
,
&&...
)
{
return (_Try_emplace(_STD move(_Keyval),
_STD forward<_Mappedty>(_Mapval)...).first);
}
template
<
class
,
class
>
(
&&
,
&&
)
{
=
::
(
);
if
(
_Where
::
()
|| _DEBUG_LT_PRED(_Mybase::_Getcomp(),
_Keyval, _Mybase::_Key(_Where._Ptr)))
||
(
::
(),
,
::
(
_Where
.
)))
return
(
(
::
(
_Where
,
_STD forward<_Keyty>(_Keyval),
_STD forward<_Mappedty>(_Mapval)),
true
));
else
{
_Where->second = _STD forward<_Mappedty>(_Mapval);
return
(
(
_Where
,
false
));
}
}
template
<
class
>
(
const
&
,
&&
)
{
return
(
(
,
_STD forward<_Mappedty>(_Mapval)));
}
template
<
class
>
(
,
const
&
,
&&
)
{
return
(
(
,
_STD forward<_Mappedty>(_Mapval)).first);
}
template
<
class
>
(
&&
,
&&
)
{
return (_Insert_or_assign(_STD move(_Keyval),
_STD forward<_Mappedty>(_Mapval)));
}
template
<
class
>
(
,
&&
,
&&
)
{
return (_Insert_or_assign(_STD move(_Keyval),
_STD forward<_Mappedty>(_Mapval)).first);
}
(
<
>
)
:
(
())
{
(
);
}
(
<
>
,
const
&
)
:
(
)
{
(
);
}
(
<
>
,
const
&
)
:
(
(),
)
{
(
);
}
(
<
>
,
const
&
,
const
&
)
:
(
,
)
{
(
);
}
&
(
<
>
)
{
::
();
(
);
return
(*
this
);
}
&
(
const
&
)
{
return
(
(
).
);
}
_NODISCARD mapped_type& at(const key_type& _Keyval)
{
=
::
(
);
if
(
_Where
::
()
||
::
()(
,
::
(
_Where
.
)))
(
"invalid map<K, T> key"
);
return
(
_Where
);
}
_NODISCARD const mapped_type& at(const key_type& _Keyval) const
{
=
::
(
);
if
(
_Where
::
()
||
::
()(
,
::
(
_Where
.
)))
(
"invalid map<K, T> key"
);
return
(
_Where
);
}
using
::
;
using
::
;
};
#if _HAS_CXX17
template<class _Iter,
class _Pr = less<_Guide_key_t<_Iter>>,
class _Alloc = allocator<_Guide_pair_t<_Iter>>,
enable_if_t<conjunction_v<
_Is_iterator<_Iter>,
negation<_Is_allocator<_Pr>>,
_Is_allocator<_Alloc>
>, int> = 0>
map(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc())
-> map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Pr, _Alloc>;
template<class _Kty,
class _Ty,
class _Pr = less<_Kty>,
class _Alloc = allocator<pair<const _Kty, _Ty>>,
enable_if_t<conjunction_v<
negation<_Is_allocator<_Pr>>,
_Is_allocator<_Alloc>
>, int> = 0>
map(initializer_list<pair<const _Kty, _Ty>>, _Pr = _Pr(), _Alloc = _Alloc())
-> map<_Kty, _Ty, _Pr, _Alloc>;
template<class _Iter,
class _Alloc,
enable_if_t<conjunction_v<
_Is_iterator<_Iter>,
_Is_allocator<_Alloc>
>, int> = 0>
map(_Iter, _Iter, _Alloc)
-> map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, less<_Guide_key_t<_Iter>>, _Alloc>;
template<class _Kty,
class _Ty,
class _Alloc,
enable_if_t<_Is_allocator<_Alloc>::value, int> = 0>
map(initializer_list<pair<const _Kty, _Ty>>, _Alloc)
-> map<_Kty, _Ty, less<_Kty>, _Alloc>;
#endif /* _HAS_CXX17 */
template
<
class
,
class
,
class
,
class
>
inline
void
(
<
,
,
,
>&
,
<
,
,
,
>&
)
_NOEXCEPT_COND(_NOEXCEPT_OPER(_Left.swap(_Right)))
{
.
(
);
}
template
<
class
,
class
,
class
=
<
>,
class
=
<
<
const
,
>>>
class
:
public
<
<
,
,
,
,
true
>>
{
public
:
static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<pair<const _Kty, _Ty>, typename _Alloc::value_type>,
static_assert
(!
0
||
<
<
const
,
>,
typename
::value_type>,
_MISMATCHED_ALLOCATOR_MESSAGE("multimap<Key, Value, Compare, Allocator>", "pair<const Key, Value>"));
"multimap<Key, Value, Compare, Allocator>"
" requires that Allocator's value_type match "
"pair<const Key, Value>"
" (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)"
" Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0"
" to suppress this diagnostic."
);
using
=
<
<
,
,
,
,
true
>>;
using
=
;
using
=
;
using
=
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
&;
using
=
const
&;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
()
:
(
())
{
}
explicit
(
const
&
)
:
(
(),
)
{
}
(
const
&
)
:
(
,
::
select_on_container_copy_construction
(
.
()))
{
}
(
const
&
,
const
&
)
:
(
,
)
{
}
explicit
(
const
&
)
:
(
)
{
}
(
const
&
,
const
&
)
:
(
,
)
{
}
template
<
class
>
(
,
)
:
(
())
{
(
,
);
}
template
<
class
>
(
,
,
const
&
)
:
(
)
{
(
,
);
}
template
<
class
>
(
,
,
const
&
)
:
(
(),
)
{
(
,
);
}
template
<
class
>
(
,
,
const
&
,
const
&
)
:
(
,
)
{
(
,
);
}
&
(
const
&
)
{
::
);
return
(*
this
);
}
(
&&
)
: _Mybase(_STD move(_Right))
{
}
(
&&
,
const
&
)
: _Mybase(_STD move(_Right), _Al)
{
}
&
(
&&
)
_NOEXCEPT_COND(_Alnode_traits::is_always_equal::value
&& is_nothrow_move_assignable_v<_Pr>)
noexcept
(
::
::
&&
is_nothrow_move_assignable_v
<
>)
{
_Mybase::operator=(_STD move(_Right));
return
(*
this
);
}
template
<
class
...
>
(
&&...
)
{
return (_Mybase::emplace(_STD forward<_Valty>(_Val)...).first);
return
(
::
(::
std
::
<
>(
)...).first);
}
void swap(multimap& _Right) _NOEXCEPT_COND(_NOEXCEPT_OPER(_Mybase::swap(_Right))) // strengthened
void
(
&
)
noexcept
(
noexcept
(
::
(
)))
{
::
(
);
}
using
::
;
template
<
class
,
class
=
<
<
,
>>>
(
&&
)
{
return (this->emplace(_STD forward<_Valty>(_Val)));
return
(
this
->
(::
std
::
<
>(
)));
}
template
<
class
,
class
=
<
<
,
>>>
(
,
&&
)
{
return (this->emplace_hint(_Where, _STD forward<_Valty>(_Val)));
return
(
this
->
(
, ::
std
::
<
>(
)));
}
(
<
>
)
:
(
())
{
(
);
}
(
<
>
,
const
&
)
:
(
)
{
(
);
}
(
<
>
,
const
&
)
:
(
(),
)
{
(
);
}
(
<
>
,
const
&
,
const
&
)
:
(
,
)
{
(
);
}
&
(
<
>
)
{
::
();
(
);
return
(*
this
);
}
using
::
;
using
::
;
};
#if _HAS_CXX17
template<class _Iter,
class _Pr = less<_Guide_key_t<_Iter>>,
class _Alloc = allocator<_Guide_pair_t<_Iter>>,
enable_if_t<conjunction_v<
_Is_iterator<_Iter>,
negation<_Is_allocator<_Pr>>,
_Is_allocator<_Alloc>
>, int> = 0>
multimap(_Iter, _Iter, _Pr = _Pr(), _Alloc = _Alloc())
-> multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Pr, _Alloc>;
template<class _Kty,
class _Ty,
class _Pr = less<_Kty>,
class _Alloc = allocator<pair<const _Kty, _Ty>>,
enable_if_t<conjunction_v<
negation<_Is_allocator<_Pr>>,
_Is_allocator<_Alloc>
>, int> = 0>
multimap(initializer_list<pair<const _Kty, _Ty>>, _Pr = _Pr(), _Alloc = _Alloc())
-> multimap<_Kty, _Ty, _Pr, _Alloc>;
template<class _Iter,
class _Alloc,
enable_if_t<conjunction_v<
_Is_iterator<_Iter>,
_Is_allocator<_Alloc>
>, int> = 0>
multimap(_Iter, _Iter, _Alloc)
-> multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, less<_Guide_key_t<_Iter>>, _Alloc>;
template<class _Kty,
class _Ty,
class _Alloc,
enable_if_t<_Is_allocator<_Alloc>::value, int> = 0>
multimap(initializer_list<pair<const _Kty, _Ty>>, _Alloc)
-> multimap<_Kty, _Ty, less<_Kty>, _Alloc>;
#endif /* _HAS_CXX17 */
template
<
class
,
class
,
class
,
class
>
inline
void
(
<
,
,
,
>&
,
<
,
,
,
>&
)
_NOEXCEPT_COND(_NOEXCEPT_OPER(_Left.swap(_Right)))
{
.
(
);
}
#if _HAS_CXX17
namespace pmr {
template<class _Kty,
class _Ty,
class _Pr = less<_Kty>>
using map = _STD map<_Kty, _Ty, _Pr, polymorphic_allocator<pair<const _Kty, _Ty>>>;
template<class _Kty,
class _Ty,
class _Pr = less<_Kty>>
using multimap = _STD multimap<_Kty, _Ty, _Pr, polymorphic_allocator<pair<const _Kty, _Ty>>>;
} // namespace pmr
#endif /* _HAS_CXX17 */
#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma warning(pop)
#pragma pack(pop)
#endif /* RC_INVOKED */
#endif /* _MAP_ */
#pragma pack(pop)