Dynamic arrays in D 1.0

Bill Baxter dnewsgroup at billbaxter.com
Sun May 11 15:34:56 PDT 2008


Janice Caron wrote:
> On 11/05/2008, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
>>  Does std.algorithm.copy work in CTFE?
> 
> I just tried it, and the answer's no. That seriously surprises me.
> 
> Apparently, it can't evaluate begin(target) at compile time.
> 
> OK - I withdraw that objection. (Although, of course, memmove will
> /never/ be CTFE compatible, whereas copy might be in the future).

Eventually I think we'll need a "static if(is(CTFE))" or equivalent.
In that case functions like copy() could use a simpler fallback 
implementation in the "is(CTFE)" block, and use the fastest possible 
solution (e.g. memmove) in the non-CTFE case.

--bb



More information about the Digitalmars-d mailing list