array copy/ref question
Sclytrack
sclytrack at pi.be
Tue Aug 12 07:51:39 PDT 2008
== Extrait de l'article de « Jesse Phillips (jessekphillips at gmail.com) »
> On Tue, 12 Aug 2008 02:42:17 +0000, Jesse Phillips wrote:
> > main( string[] args )
> > {
> > int[] test = [ 1, 2, 3, 4 ];
> > int[] copy = new int[4];
> >
> > copy[] = test;
> > test[1] = 11;
> >
> > assert( test[1] == 11 );
> > assert( copy[1] == 2 );
> >
> > writefln( "Copy: test[1] %d copy[1] %d", test[1], copy[1] );
> > }
copy = test.dup; //Is this what you want?
More information about the Digitalmars-d
mailing list