Copying structs via function (not bitwise)

Matthias Walter walter at mail.math.uni-magdeburg.de
Sat Feb 16 12:42:39 PST 2008


downs Wrote:

> Bill Baxter wrote:
> > 
> > You can't make natural syntax work for everything but you _can_ make
> > unnatural syntax work for everything.  I.e. you could make it so that:
> > 
> > T i,j = 0;
> > assign(i,j);
> > j++;
> > assert(i==0);
> > 
> > works for all the T's you want it to.
> > Not quite as sweet as having it all appear to be built-in but better
> > than a spoon in the eye.
> > 
> > --bb
> 
> How about keeping to D conventions, and using j = i.dup?
> 
>  --downs

Do you code all your stuff with D conventions - _also_ for numbers?

| int start = 10;
| int end = 20;
| 
| for (i = start.dup; i < end; i++)
| {
| 
| }

when dealing with integers, you normally don't use .dup, do you? And the sense of GMP is the easy usage of arbitrary precision numbers as they were ints, longs or floats...

best regards
Matthias Walter


More information about the Digitalmars-d-learn mailing list