c++.beta - std::rel_ops template operator generate fail
- nyra <nyra_member pathlink.com> Dec 05 2003
#include <utility>
struct Test{
int i;
Test(int a): i(a){}
bool operator==(const Test & aTest) const{
return i == aTest.i;
}
};
namespace std{
//namespace rel_ops{
template <class _Tp>
inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y) {
return !(__x == __y);
}
//}
}
using namespace std;//::rel_ops; //auto generate operator !=, <= , > ,
=std::rel_ops; //auto generate operator !=, <= , > , >=
int main( ){
Test a(0), b(3);
a == b; //ok
a != b;
return 0;
}
it seems dmc did not search template in imported namespace !
Dec 05 2003








nyra <nyra_member pathlink.com>