Re: template parameters cannot be friends

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux