Alexander Stippler wrote in news::
>
> Why is there no matching operator== in the following code?
>
>
Victor and Michael have already answered that.
I rewrote you code with a member operator==(), and it compiles
fine on 2/3 of the compilers I tested. Is there some reason
you need operator==() to be a non-member ?
#include <iostream>
#include <ostream>
template <class T>
class A
{
public:
template <class S>
class B;
};
template <class T>
template <class S>
class A<T>::B
{
public:
template <typename A2>
bool operator==(B<A2> const &rhs) const
{
return true;
}
};
int main()
{
A<int>::B<int> ab1;
A<int>::B<double> ab2;
std::cerr << (ab1 == ab2) << std::endl;
return 0;
}
HTH
Rob.
--
http://www.victim-prime.dsl.pipex.com/