D
Duncan Smith
I know that template specializtion is not included in generics, but
was wondering whether or not there is an elegant alternative?
The first function is always called, but I was hoping that for
instances of type RealPoint (ComparePointByFiaNumber<RealPoint)>) the
second function would be called.
To implement different behavious based upon the type, do I have to
have a switch within Equals() that will check the type of T and then
call different functions as needed?
Many thanks,
Duncan
generic<typename T>
ref class ComparePointByFiaNumber : Generic::IEqualityComparer<T>
{
public:
virtual bool Equals( T x, T y )
{
Generic::IEqualityComparer<T>^ equalityComparer =
Generic::EqualityComparer<T>:efault;
return equalityComparer->Equals( x,y );
}
virtual bool Equals( RealPoint^ x, RealPoint^ y )
{
return true;
}
was wondering whether or not there is an elegant alternative?
The first function is always called, but I was hoping that for
instances of type RealPoint (ComparePointByFiaNumber<RealPoint)>) the
second function would be called.
To implement different behavious based upon the type, do I have to
have a switch within Equals() that will check the type of T and then
call different functions as needed?
Many thanks,
Duncan
generic<typename T>
ref class ComparePointByFiaNumber : Generic::IEqualityComparer<T>
{
public:
virtual bool Equals( T x, T y )
{
Generic::IEqualityComparer<T>^ equalityComparer =
Generic::EqualityComparer<T>:efault;
return equalityComparer->Equals( x,y );
}
virtual bool Equals( RealPoint^ x, RealPoint^ y )
{
return true;
}