I have a template like so:
template SIMD(width:untyped,body:untyped) =
and I'd like to make a template like this;
template simdFor[T](a:openarray[T], body:untyped) =
for i in countup(0,a.len,width): #etc
where the second template depends on the width variable from the first template existing. Is something like this possible? I tried this directly and get strange errors, which I suspect may just mean you can't have templates in templates.
I don't want the for loop to run at compile time, so that is ok.
I was able to print out the template expansion at compile time and it looks like when I added the inner template, the body gets a single quote character appended to it.
edit: ok, I tracked down the issue.
template1 used a parameter named body, innertemplate also used a parameter named body. This seems to have caused the problem.