@@ -643,36 +643,9 @@ _LIBCPP_PUSH_MACROS
643
643
644
644
_LIBCPP_BEGIN_NAMESPACE_STD
645
645
646
- template <class _Key ,
647
- class _Cp ,
648
- class _Hash ,
649
- class _Pred ,
650
- bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
651
- class __unordered_map_hasher : private _Hash {
652
- public:
653
- _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher () _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value) : _Hash() {}
654
- _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher (const _Hash& __h) _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
655
- : _Hash(__h) {}
656
- _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function () const _NOEXCEPT { return *this ; }
657
- _LIBCPP_HIDE_FROM_ABI size_t operator ()(const _Cp& __x) const {
658
- return static_cast <const _Hash&>(*this )(__x.__get_value ().first );
659
- }
660
- _LIBCPP_HIDE_FROM_ABI size_t operator ()(const _Key& __x) const { return static_cast <const _Hash&>(*this )(__x); }
661
- # if _LIBCPP_STD_VER >= 20
662
- template <typename _K2>
663
- _LIBCPP_HIDE_FROM_ABI size_t operator ()(const _K2& __x) const {
664
- return static_cast <const _Hash&>(*this )(__x);
665
- }
666
- # endif
667
- _LIBCPP_HIDE_FROM_ABI void swap (__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Hash>) {
668
- using std::swap;
669
- swap (static_cast <_Hash&>(*this ), static_cast <_Hash&>(__y));
670
- }
671
- };
672
-
673
646
template <class _Key , class _Cp , class _Hash , class _Pred >
674
- class __unordered_map_hasher <_Key, _Cp, _Hash, _Pred, false > {
675
- _Hash __hash_;
647
+ class __unordered_map_hasher {
648
+ _LIBCPP_COMPRESSED_ELEMENT ( _Hash, __hash_) ;
676
649
677
650
public:
678
651
_LIBCPP_HIDE_FROM_ABI __unordered_map_hasher () _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
@@ -694,60 +667,16 @@ public:
694
667
}
695
668
};
696
669
697
- template <class _Key , class _Cp , class _Hash , class _Pred , bool __b >
670
+ template <class _Key , class _Cp , class _Hash , class _Pred >
698
671
inline _LIBCPP_HIDE_FROM_ABI void
699
- swap (__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b >& __x,
700
- __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
672
+ swap (__unordered_map_hasher<_Key, _Cp, _Hash, _Pred>& __x, __unordered_map_hasher<_Key, _Cp, _Hash, _Pred>& __y)
673
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
701
674
__x.swap (__y);
702
675
}
703
676
704
- template <class _Key ,
705
- class _Cp ,
706
- class _Pred ,
707
- class _Hash ,
708
- bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value>
709
- class __unordered_map_equal : private _Pred {
710
- public:
711
- _LIBCPP_HIDE_FROM_ABI __unordered_map_equal () _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value) : _Pred() {}
712
- _LIBCPP_HIDE_FROM_ABI __unordered_map_equal (const _Pred& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
713
- : _Pred(__p) {}
714
- _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq () const _NOEXCEPT { return *this ; }
715
- _LIBCPP_HIDE_FROM_ABI bool operator ()(const _Cp& __x, const _Cp& __y) const {
716
- return static_cast <const _Pred&>(*this )(__x.__get_value ().first , __y.__get_value ().first );
717
- }
718
- _LIBCPP_HIDE_FROM_ABI bool operator ()(const _Cp& __x, const _Key& __y) const {
719
- return static_cast <const _Pred&>(*this )(__x.__get_value ().first , __y);
720
- }
721
- _LIBCPP_HIDE_FROM_ABI bool operator ()(const _Key& __x, const _Cp& __y) const {
722
- return static_cast <const _Pred&>(*this )(__x, __y.__get_value ().first );
723
- }
724
- # if _LIBCPP_STD_VER >= 20
725
- template <typename _K2>
726
- _LIBCPP_HIDE_FROM_ABI bool operator ()(const _Cp& __x, const _K2& __y) const {
727
- return static_cast <const _Pred&>(*this )(__x.__get_value ().first , __y);
728
- }
729
- template <typename _K2>
730
- _LIBCPP_HIDE_FROM_ABI bool operator ()(const _K2& __x, const _Cp& __y) const {
731
- return static_cast <const _Pred&>(*this )(__x, __y.__get_value ().first );
732
- }
733
- template <typename _K2>
734
- _LIBCPP_HIDE_FROM_ABI bool operator ()(const _Key& __x, const _K2& __y) const {
735
- return static_cast <const _Pred&>(*this )(__x, __y);
736
- }
737
- template <typename _K2>
738
- _LIBCPP_HIDE_FROM_ABI bool operator ()(const _K2& __x, const _Key& __y) const {
739
- return static_cast <const _Pred&>(*this )(__x, __y);
740
- }
741
- # endif
742
- _LIBCPP_HIDE_FROM_ABI void swap (__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Pred>) {
743
- using std::swap;
744
- swap (static_cast <_Pred&>(*this ), static_cast <_Pred&>(__y));
745
- }
746
- };
747
-
748
677
template <class _Key , class _Cp , class _Pred , class _Hash >
749
- class __unordered_map_equal <_Key, _Cp, _Pred, _Hash, false > {
750
- _Pred __pred_;
678
+ class __unordered_map_equal {
679
+ _LIBCPP_COMPRESSED_ELEMENT ( _Pred, __pred_) ;
751
680
752
681
public:
753
682
_LIBCPP_HIDE_FROM_ABI __unordered_map_equal () _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
@@ -788,9 +717,9 @@ public:
788
717
}
789
718
};
790
719
791
- template <class _Key , class _Cp , class _Pred , class _Hash , bool __b >
720
+ template <class _Key , class _Cp , class _Pred , class _Hash >
792
721
inline _LIBCPP_HIDE_FROM_ABI void
793
- swap (__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b >& __x, __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b >& __y)
722
+ swap (__unordered_map_equal<_Key, _Cp, _Pred, _Hash>& __x, __unordered_map_equal<_Key, _Cp, _Pred, _Hash>& __y)
794
723
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
795
724
__x.swap (__y);
796
725
}
0 commit comments