型が定義されているか判定する

cppll:13290「その型があるかどうか」の判定方法より
標準C++内(多分)でやる方法。判定できるだけで、実用性はほとんどないけどな。
http://okwave.jp/qa3450940.htmlにあるコードを少しだけいじった。

typedef int* TYPE;

namespace hoge{
  struct dummy_class {};
  typedef dummy_class TYPE;
}
using namespace hoge;

template <class T, class U>
struct is_same
{
  static const bool value = false;
};
template <class T>
struct is_same<T,T>
{
  static const bool value = true;
};


int main()
{
  if (!is_same< ::TYPE, hoge::dummy_class>::value)
  {
    // TYPEが定義されている場合のコード
  }
  else
  {
    // TYPEが定義されていない場合のコード
  }
  return 0;
}