Remove implicit conversion from __value_type to value_type in [unordered_][multi]map. This fixes http://llvm.org/bugs/show_bug.cgi?id=16549
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185711 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
33
include/map
33
include/map
@@ -381,7 +381,7 @@ swap(multimap<Key, T, Compare, Allocator>& x,
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value
|
||||
template <class _Key, class _CP, class _Compare, bool = is_empty<_Compare>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Compare)
|
||||
#endif
|
||||
@@ -389,7 +389,6 @@ template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::valu
|
||||
class __map_value_compare
|
||||
: private _Compare
|
||||
{
|
||||
typedef pair<const _Key, _Tp> _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<const _Compare&>(*this)(__x.first, __y.first);}
|
||||
{return static_cast<const _Compare&>(*this)(__x.__cc.first, __y.__cc.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _Key& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
|
||||
{return static_cast<const _Compare&>(*this)(__x.__cc.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _CP& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
|
||||
{return static_cast<const _Compare&>(*this)(__x, __y.__cc.first);}
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp, class _Compare>
|
||||
class __map_value_compare<_Key, _Tp, _Compare, false>
|
||||
template <class _Key, class _CP, class _Compare>
|
||||
class __map_value_compare<_Key, _CP, _Compare, false>
|
||||
{
|
||||
_Compare comp;
|
||||
|
||||
typedef pair<const _Key, _Tp> _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 <class _Allocator>
|
||||
@@ -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 <class _A0, class _A1>
|
||||
__value_type(const _A0& __a0, const _A1& __a1)
|
||||
: __cc(__a0, __a1) {}
|
||||
|
||||
operator const value_type& () const {return __cc;}
|
||||
};
|
||||
#endif
|
||||
typedef __map_value_compare<key_type, mapped_type, key_compare> __vc;
|
||||
typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
|
||||
typedef typename allocator_traits<allocator_type>::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 <class _A0, class _A1>
|
||||
__value_type(const _A0& __a0, const _A1& __a1)
|
||||
: __cc(__a0, __a1) {}
|
||||
|
||||
operator const value_type& () const {return __cc;}
|
||||
};
|
||||
#endif
|
||||
typedef __map_value_compare<key_type, mapped_type, key_compare> __vc;
|
||||
typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
|
||||
typedef typename allocator_traits<allocator_type>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__value_type>
|
||||
|
Reference in New Issue
Block a user