![]() |
Blitz Support : |
From: Kirill Titievsky (kiroosha_at_[hidden])
Date: 2005-06-15 12:04:47
This solved it. Thanks, Bill. This is my first C++ project -- that
was the real problem :)
On 6/15/05, William Gallafent <william_at_[hidden]> wrote:
> On Wednesday 15 June 2005 15:26, Kirill Titievsky wrote:
>
> > Array<int,1> * pA;
>
> pA is an uninitialized pointer to an array.
>
> > Array<int,1> A;
>
> A is an instance of an array on the stack (default
> constructed).
>
> > pA = new Array<int,1>(10);
>
> Construct an array on the heap, and make pA contain its
> address.
>
> > A = *pA;
>
> So copy the array pointed to by pA in to A, by calling
> operator= on A.
>
> > The result is: &A != pA
>
> Of course. &A is the address of the array you allocated on
> the stack, and pA holds the address of the one which you
> allocated on the heap using new.
>
> Perhaps you're actually trying to do this:
>
> // Construct array on the heap
> Array<int,1>* pA = new Array<int,1> (10);
>
> // Make a reference to that array
> Array<int,1>& A = *pA;
>
> HTH,
>
> --
> Bill
>
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>