This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
It should look more like:
template <class _Lhs, class _Rhs = _Lhs> struct equal_to { bool operator()(const _Lhs& __lhs, const _Lhs& __rhs) const {return __lhs == __rhs;} bool operator()(const _Lhs& __lhs, const _Rhs& __rhs) const {return __lhs == __rhs;} bool operator()(const _Rhs& __lhs, const _Lhs& __rhs) const {return __lhs == __rhs;} bool operator()(const _Rhs& __lhs, const _Rhs& __rhs) const {return __lhs == __rhs;} };
template <class _Lhs> struct equal_to<_Lhs, _Lhs> { bool operator()(const _Lhs& __lhs, const _Lhs& __rhs) const {return __lhs == __rhs;} };
After chucking this through my own code, the only problem I found was you also need:
template <class _Lhs>
struct equal_to<_Lhs, const _Lhs>
{
bool operator()(const _Lhs& __lhs, const _Lhs& __rhs) const {return
__lhs == __rhs;}
};
template <class _Lhs>
struct equal_to<const _Lhs, _Lhs>
{
bool operator()(const _Lhs& __lhs, const _Lhs& __rhs) const {return
__lhs == __rhs;}
};
to make equal_to<int, const int> work.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |