template parameters cannot be friends
naje
najeiv@ukr.net
Fri May 21 16:48:00 GMT 2004
Hi, Eljay
> You may be able to get away with using a BOOST static assert in a two-stage
> template Draw function, which compares the T class to Button<T2> class, to
> make sure that T and T2 are the same.
how can i do this, only i've considered is
template<typename T>
struct Type2Type{};
template<typename T>
void DrawHlpr(const Button<T>& t, const Type2Type<T>&)
{
const T& tmp=static_cast<const T&>(t);
tmp.Draw();
}
template<typename T>
void Draw(const T& t)
{
DrawHlpr(t,Type2Type<T>());
}
it looks very ugly, and need to be in every template such as Draw
can you advice me something else?
Thank you.
More information about the Gcc-help
mailing list