Здравствуйте, Павел Кузнецов, Вы писали:
ПК>Здравствуйте, Andrew S, Вы писали:
AS>>А мне как то больше понравился такой вариант (где нет статического T _t):
AS>>AS>>template<class T>
AS>>class IsPointer
AS>>{
AS>> static T rett();
AS>>
AS>> enum { value = sizeof(ptr_discriminator(rett())) == sizeof(TrueType) };
AS>>
ПК>Странно... Мне почему-то следующее кажется короче и проще (как минимум меньше скобочек ):
ПК>ПК>template<class T>
ПК>class IsPointer
ПК>{
ПК> static T t_;
ПК> enum { value = sizeof(ptr_discriminator(t_)) == sizeof(TrueType) };
ПК>
Хм.. А это ещё и с абстрактными классами под M$ работает:
template<class T>
class IsPointer
{
static T* t_;
enum { value = sizeof(ptr_discriminator(*t_)) == sizeof(TrueType) };
[In theory there is no difference between theory and practice. In
practice there is.]
[Даю очевидные ответы на риторические вопросы]