1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
template <typename T, typename S>
struct Decl
{
    typedef typename Decl<S,T>::Type Type;
};

// case where both types are the same
template <typename T>
struct Decl<T,T>
{
    typedef T Type;
};

template <>
struct Decl<int, double>
{
    typedef double Type;
};