template instantiation trouble
From: Alexander Stippler (stip_at_mathematik.uni-ulm.de)
Date: 12/31/03
- Next message: Elijah Bailey: "Sorting records using sort()"
- Previous message: Piotre Ugrumov: "Problems with the execution of class hierarchy"
- Next in thread: Dave: "Re: template instantiation trouble"
- Reply: Dave: "Re: template instantiation trouble"
- Reply: Nick Hounsome: "Re: template instantiation trouble"
- Reply: Dave: "Re: template instantiation trouble"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 31 Dec 2003 14:05:22 +0100
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
- Next message: Elijah Bailey: "Sorting records using sort()"
- Previous message: Piotre Ugrumov: "Problems with the execution of class hierarchy"
- Next in thread: Dave: "Re: template instantiation trouble"
- Reply: Dave: "Re: template instantiation trouble"
- Reply: Nick Hounsome: "Re: template instantiation trouble"
- Reply: Dave: "Re: template instantiation trouble"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|