Built-in arrays as output ranges

Steve Teale steve.teale at britseyeview.com
Sun Feb 7 21:51:05 PST 2010


> 
> enforce() will never be disabled.
> 
> As an aside, I just realized I haven't implemented put for strings yet,
> and also that I'd promised a check in this weekend.
> 
> 
> Andrei

Actually, thinking about this overnight, I'm a bit unhappy about giving 
the impression that a built-in array can serve as an output range. It 
really isn't true unless you never want to see the output again. If you 
do, some data structure is required, either a loose combination of an 
array and an unprotected reference to its original state (arrays a and 
b), or something more explicit like:

struct arrayOutputRange(T)
{
    T[] array;
    uint pos;

    this(uint sx) { ... }
    void put(T val) { ... }
}

Steve




More information about the Digitalmars-d mailing list