diff --git a/include/map b/include/map index 4107eadd..953743a6 100644 --- a/include/map +++ b/include/map @@ -381,7 +381,7 @@ swap(multimap& x, _LIBCPP_BEGIN_NAMESPACE_STD -template ::value +template ::value #if __has_feature(is_final) && !__is_final(_Compare) #endif @@ -389,7 +389,6 @@ template ::valu class __map_value_compare : private _Compare { - typedef pair _CP; public: _LIBCPP_INLINE_VISIBILITY __map_value_compare() @@ -403,22 +402,20 @@ public: const _Compare& key_comp() const _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY bool operator()(const _CP& __x, const _CP& __y) const - {return static_cast(*this)(__x.first, __y.first);} + {return static_cast(*this)(__x.__cc.first, __y.__cc.first);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _CP& __x, const _Key& __y) const - {return static_cast(*this)(__x.first, __y);} + {return static_cast(*this)(__x.__cc.first, __y);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _CP& __y) const - {return static_cast(*this)(__x, __y.first);} + {return static_cast(*this)(__x, __y.__cc.first);} }; -template -class __map_value_compare<_Key, _Tp, _Compare, false> +template +class __map_value_compare<_Key, _CP, _Compare, false> { _Compare comp; - typedef pair _CP; - public: _LIBCPP_INLINE_VISIBILITY __map_value_compare() @@ -433,13 +430,13 @@ public: _LIBCPP_INLINE_VISIBILITY bool operator()(const _CP& __x, const _CP& __y) const - {return comp(__x.first, __y.first);} + {return comp(__x.__cc.first, __y.__cc.first);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _CP& __x, const _Key& __y) const - {return comp(__x.first, __y);} + {return comp(__x.__cc.first, __y);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _CP& __y) const - {return comp(__x, __y.first);} + {return comp(__x, __y.__cc.first);} }; template @@ -688,8 +685,6 @@ private: {__nc = std::move(__v.__nc); return *this;} ~__value_type() {__cc.~value_type();} - - operator const value_type& () const {return __cc;} }; #else struct __value_type @@ -706,11 +701,9 @@ private: template __value_type(const _A0& __a0, const _A1& __a1) : __cc(__a0, __a1) {} - - operator const value_type& () const {return __cc;} }; #endif - typedef __map_value_compare __vc; + typedef __map_value_compare __vc; typedef typename allocator_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__value_type> @@ -1407,8 +1400,6 @@ private: {__nc = std::move(__v.__nc); return *this;} ~__value_type() {__cc.~value_type();} - - operator const value_type& () const {return __cc;} }; #else struct __value_type @@ -1425,11 +1416,9 @@ private: template __value_type(const _A0& __a0, const _A1& __a1) : __cc(__a0, __a1) {} - - operator const value_type& () const {return __cc;} }; #endif - typedef __map_value_compare __vc; + typedef __map_value_compare __vc; typedef typename allocator_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__value_type> diff --git a/include/unordered_map b/include/unordered_map index 0d2ce292..78e63075 100644 --- a/include/unordered_map +++ b/include/unordered_map @@ -325,7 +325,7 @@ template _LIBCPP_BEGIN_NAMESPACE_STD -template ::value +template ::value #if __has_feature(is_final) && !__is_final(_Hash) #endif @@ -333,7 +333,6 @@ template ::value class __unordered_map_hasher : private _Hash { - typedef pair _Cp; public: _LIBCPP_INLINE_VISIBILITY __unordered_map_hasher() @@ -347,18 +346,17 @@ public: const _Hash& hash_function() const _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Cp& __x) const - {return static_cast(*this)(__x.first);} + {return static_cast(*this)(__x.__cc.first);} _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Key& __x) const {return static_cast(*this)(__x);} }; -template -class __unordered_map_hasher<_Key, _Tp, _Hash, false> +template +class __unordered_map_hasher<_Key, _Cp, _Hash, false> { _Hash __hash_; - typedef pair _Cp; public: _LIBCPP_INLINE_VISIBILITY __unordered_map_hasher() @@ -372,13 +370,13 @@ public: const _Hash& hash_function() const _NOEXCEPT {return __hash_;} _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Cp& __x) const - {return __hash_(__x.first);} + {return __hash_(__x.__cc.first);} _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Key& __x) const {return __hash_(__x);} }; -template ::value +template ::value #if __has_feature(is_final) && !__is_final(_Pred) #endif @@ -386,7 +384,6 @@ template ::value class __unordered_map_equal : private _Pred { - typedef pair _Cp; public: _LIBCPP_INLINE_VISIBILITY __unordered_map_equal() @@ -400,21 +397,20 @@ public: const _Pred& key_eq() const _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Cp& __x, const _Cp& __y) const - {return static_cast(*this)(__x.first, __y.first);} + {return static_cast(*this)(__x.__cc.first, __y.__cc.first);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Cp& __x, const _Key& __y) const - {return static_cast(*this)(__x.first, __y);} + {return static_cast(*this)(__x.__cc.first, __y);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Cp& __y) const - {return static_cast(*this)(__x, __y.first);} + {return static_cast(*this)(__x, __y.__cc.first);} }; -template -class __unordered_map_equal<_Key, _Tp, _Pred, false> +template +class __unordered_map_equal<_Key, _Cp, _Pred, false> { _Pred __pred_; - typedef pair _Cp; public: _LIBCPP_INLINE_VISIBILITY __unordered_map_equal() @@ -428,13 +424,13 @@ public: const _Pred& key_eq() const _NOEXCEPT {return __pred_;} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Cp& __x, const _Cp& __y) const - {return __pred_(__x.first, __y.first);} + {return __pred_(__x.__cc.first, __y.__cc.first);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Cp& __x, const _Key& __y) const - {return __pred_(__x.first, __y);} + {return __pred_(__x.__cc.first, __y);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Cp& __y) const - {return __pred_(__x, __y.first);} + {return __pred_(__x, __y.__cc.first);} }; template @@ -655,8 +651,6 @@ private: {__nc = std::move(__v.__nc); return *this;} ~__value_type() {__cc.~value_type();} - - operator const value_type& () const {return __cc;} }; #else struct __value_type @@ -673,12 +667,10 @@ private: template __value_type(const _A0& __a0, const _A1& __a1) : __cc(__a0, __a1) {} - - operator const value_type& () const {return __cc;} }; #endif - typedef __unordered_map_hasher __hasher; - typedef __unordered_map_equal __key_equal; + typedef __unordered_map_hasher __hasher; + typedef __unordered_map_equal __key_equal; typedef typename allocator_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__value_type> @@ -1321,8 +1313,6 @@ private: {__nc = std::move(__v.__nc); return *this;} ~__value_type() {__cc.~value_type();} - - operator const value_type& () const {return __cc;} }; #else struct __value_type @@ -1339,12 +1329,10 @@ private: template __value_type(const _A0& __a0, const _A1& __a1) : __cc(__a0, __a1) {} - - operator const value_type& () const {return __cc;} }; #endif - typedef __unordered_map_hasher __hasher; - typedef __unordered_map_equal __key_equal; + typedef __unordered_map_hasher __hasher; + typedef __unordered_map_equal __key_equal; typedef typename allocator_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__value_type> diff --git a/test/containers/associative/map/compare.pass.cpp b/test/containers/associative/map/compare.pass.cpp index f5e69173..aa4d5999 100644 --- a/test/containers/associative/map/compare.pass.cpp +++ b/test/containers/associative/map/compare.pass.cpp @@ -14,6 +14,7 @@ // class map // http://llvm.org/bugs/show_bug.cgi?id=16538 +// http://llvm.org/bugs/show_bug.cgi?id=16549 #include @@ -26,4 +27,6 @@ int main() { std::map::iterator it = std::map().find(Key(0)); + std::pair::iterator, bool> result = + std::map().insert(std::make_pair(Key(0), 0)); } diff --git a/test/containers/unord/unord.map/compare.pass.cpp b/test/containers/unord/unord.map/compare.pass.cpp index 814c40f2..8979a3a3 100644 --- a/test/containers/unord/unord.map/compare.pass.cpp +++ b/test/containers/unord/unord.map/compare.pass.cpp @@ -14,6 +14,7 @@ // class unordered_map // http://llvm.org/bugs/show_bug.cgi?id=16538 +// http://llvm.org/bugs/show_bug.cgi?id=16549 #include @@ -36,4 +37,6 @@ main() { std::unordered_map::iterator it = std::unordered_map().find(Key(0)); + std::pair::iterator, bool> result = + std::unordered_map().insert(std::make_pair(Key(0), 0)); }