templated static array

bearophile bearophileHUGS at lycos.com
Mon Oct 15 07:30:02 PDT 2012


Namespace:

> I have this code: http://dpaste.dzfl.pl/d9165502

void receive(alias n, T)(T[n] vals) {

No need to use alias there, this is better:

void receive(size_t n, T)(T[n] vals) {


> But how can I tell the compiler, that this function takes 
> (preferably) static arrays?

Define "preferably" please.
Often template constraints are able to do many things (and there 
is a isStaticArray trait).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list