templated static array

Simen Kjaeraas simen.kjaras at gmail.com
Mon Oct 15 07:23:09 PDT 2012


On 2012-05-15 16:10, Namespace <rswhite4 at googlemail.com> wrote:

> How can I do this?
>
> I have this code: http://dpaste.dzfl.pl/d9165502
>
> And as you can see, the templated function 'receive2' take automatically  
> dynamic arrays. But how can I tell the compiler, that this function  
> takes (preferably) static arrays?
> My little "hack" function 'receive' take the type and the number of  
> elements. So the compiler know: it's a static array. But is there no  
> simpler trick to do this?
> Maybe something like 'void receive(T)(static T vals) {'.

Nope. That's the way to do it.

-- 
Simen


More information about the Digitalmars-d-learn mailing list