// test.cpp - Aplicación
#include <iostream>
using namespace std;

class Cx
{
  public:
    template<class T> T menor(T a, T b)
    {
      return a < b ? a : b;
    }
};

template<class T1 = int, class T2 = T1 *> class Cy
{
  public:
    class Cz
    {
    };
    
    template<int K = 3> class Cx2
    {
      public:
        template<class T3> static T2 f(T3 n)
        {
          return new T1[n*K];
        }
    };
};

/*
// Forma equivalente de escribir la definición de la plantilla Cy
template<class T1 = int, class T2 = T1 *> class Cy
{
  public:
    class Cz;
    template<int K = 3> class Cx2;
};

template<class T1, class T2> class Cy<T1,T2>::Cz
{
};

template<class T1, class T2>
template<int K> class Cy<T1,T2>::Cx2
{
  public:
    template<class T3> static T2 f(T3);
};

template<class T1, class T2>
template<int K>
template<class T3>
T2 Cy<T1,T2>::Cx2<K>::f(T3 n)
{
  return new T1[n*K];
}
*/

int main()
{
  Cx obx;
  Cy<int> oby;
  Cy<double>::Cx2<> obx2;
  
  int m = obx.menor(6, 3);
  cout << m << endl;
  double *a = obx2.f<int>(2);
  a[1] = 10;
  cout << a[1] << endl;
  // ...
  delete [] a;
}

