Simplify comparators of [unordered_][multi]map. This fixes http://llvm.org/bugs/show_bug.cgi?id=16538

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185665 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2013-07-04 19:46:35 +00:00
parent 4dca0440f5
commit e008d4eecc
4 changed files with 68 additions and 84 deletions

View File

@@ -389,7 +389,6 @@ template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::valu
class __map_value_compare
: private _Compare
{
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
typedef pair<const _Key, _Tp> _CP;
public:
_LIBCPP_INLINE_VISIBILITY
@@ -406,29 +405,11 @@ public:
bool operator()(const _CP& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y);}
};
template <class _Key, class _Tp, class _Compare>
@@ -436,7 +417,6 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
{
_Compare comp;
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
typedef pair<const _Key, _Tp> _CP;
public:
@@ -455,29 +435,11 @@ public:
bool operator()(const _CP& __x, const _CP& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Pp& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const
{return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _CP& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _Pp& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _Key& __y) const
{return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Pp& __y) const
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
{return comp(__x, __y);}
};
template <class _Allocator>