[Insight-developers] Depth of nested templates

Yinpeng Jin yj76@columbia.edu
Wed, 14 Mar 2001 14:40:52 -0500


As Brad told me, I have this too deep nested template problem in my code:

typedef   itk::Point<int,2> EdgeInfo;
std::vector< std::deque<EdgeInfo> > rawEdges;

I don't know how far I can go. the first line should be fine since it is
just an instantiation of itkPoint.
can we go std::vector<EdgeInfo> or std::deque<EdgeInfo>?
any suggestion on this?
the problem is I have a list of polygon (size of the list is unkown), for
each polygon there will be a list of EdgeInfo (again the size of those lists
are unknow).

what if I know the size of the polygon list as an nonconstant varible.
are we allow to do this:

typedef std::deque<EdgeInfo> EdgeInfoQ
EdgeInfoQ *rawEdges = new EdgeInfoQ[knowSize];

I remember somebody addressed this standard C++ "new" operation issue
before, forgot the details.

Yinpeng