[Insight-developers] template depth limit

Lydia Ng lng@insightful.com
Thu, 28 Jun 2001 14:31:16 -0700


The number of classes instantiated is not the whole
picture.
You can actually exceed the limit with just one class
(see below) if it recursively calls its own member functions enough times.

Lydia

----------------------

template<class T>
class MyClass
{

public:
  MyClass() { f1(); }
  void f1(){ f2(); }
  void f2(){ f3(); }
  void f3(){ f4(); }
  void f4(){ f5(); }
  void f5(){ f6(); }
  void f6(){ f7(); }
  void f7(){ f8(); }
  void f8(){ f9(); }
  void f9(){ f10(); }
  void f10(){ f11(); }
  void f11(){ f12(); }
  void f12(){ f13(); }
  void f13(){ f14(); }
  void f14(){ f15(); }
  void f15(){ f16(); }
  void f16(){ f17(); }
  void f17(){ f18(); }
  void f18(){ f19(); }
  void f19(){ std::cout << "hello" << std::endl; }

};