how does range.put work

Daniel Keep daniel.keep.lists at gmail.com
Thu Aug 6 20:53:05 PDT 2009



O.K. wrote:
> Hello,
> could someone plz clearify what the exact semantics of "put"
> are ?
> Put works with an appender, but gives me a runtime exception
> when using an array.
> 
> Best regards,
> Oliver

The source code for the standard library comes with the compiler.

If you look in std\array.d, you find this around line 279 (reflowed for
readability):

> void put(T, E)(ref T[] a, E e) {
>     assert(a.length);
>     a[0] = e; a = a[1 .. $];
> }


More information about the Digitalmars-d-learn mailing list