A
Alexander Stippler
Hello,
I wrote an (templatized) operator==() and don't know why the compiler
doesn't consider it. What prevents it from being chosen?
class Data {};
template <typename D>
class Vector
{
public:
typedef Data ConstType;
typedef Data Type;
};
template <typename D>
bool
operator==(const typename Vector<D>::ConstType &lhs,
const typename Vector<D>::Type &rhs)
{
return true;
}
// this operator is chosen, if added.
//bool
//operator==(const Vector<Data>::ConstType &lhs,
// const Vector<Data>::Type &rhs)
//{
// return true;
//}
int
main()
{
Vector<Data>::ConstType ct;
Vector<Data>::Type t;
ct == t;
return 0;
}
What is not standard conforming, what is not allowed here?
regards,
alex
I wrote an (templatized) operator==() and don't know why the compiler
doesn't consider it. What prevents it from being chosen?
class Data {};
template <typename D>
class Vector
{
public:
typedef Data ConstType;
typedef Data Type;
};
template <typename D>
bool
operator==(const typename Vector<D>::ConstType &lhs,
const typename Vector<D>::Type &rhs)
{
return true;
}
// this operator is chosen, if added.
//bool
//operator==(const Vector<Data>::ConstType &lhs,
// const Vector<Data>::Type &rhs)
//{
// return true;
//}
int
main()
{
Vector<Data>::ConstType ct;
Vector<Data>::Type t;
ct == t;
return 0;
}
What is not standard conforming, what is not allowed here?
regards,
alex