<div class="gmail_quote">On 23 January 2012 21:55, Manu <span dir="ltr"><<a href="mailto:turkeyman@gmail.com">turkeyman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><div class="gmail_quote">On 23 January 2012 21:31, Walter Bright <span dir="ltr"><<a href="mailto:newshound2@digitalmars.com" target="_blank">newshound2@digitalmars.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>On 1/23/2012 10:58 AM, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So I've been fiddling, but I can't work it out.<br>
Trying to make something like isStaticArray to match a vector...<br>
<br>
template isVector(T : __vector(U[N]), U, size_t N) { enum bool isVector = true; }<br>
template isVector(T) { enum bool isVector = false; }<br>
<br>
Complains:<br>
test.d:122: Error: Integer constant expression expected instead of N<br>
test.d:122: Error: size of type U is not known<br>
test.d:122: Error: base type of __vector must be a 16 byte static array, not U[N]<br>
<br>
A size_t template arg should be an integer constant expression, and<br>
consequently, the size of U should be known... Bug?<br>
</blockquote>
<br></div></div>
Code would have to be added to the compiler to make that work. In the meantime, you can simply enumerate the supported aliases for vector types.<br>
</blockquote></div><br></div></div><div>Ah, of course!</div><div>Deeer, I didn't think of that! :P</div>
</blockquote></div><br><div>... I guess I'll need to do this one the same way:</div><div>template VectorType(T : __vector(T[N]), size_t N) { alias T VectorType; }</div>