how to use new at tnt library.

Claudio Bley bley@CS.uni-magdeburg.de
Tue Oct 19 14:31:00 GMT 2004


Hi.

On Tue, Oct 19, 2004 at 08:54:34AM -0500, Eljay Love-Jensen wrote:
> Hi Marcelo,
> 
> I'm not familiar with the TNT library you're using.
> 
> If the Array1D<how>(int) constructor creates what I presume it's creating, 
> it should work.  But I'm making presumptions that may be .
> 
> --Eljay
 
I presume it's creating an object with array semantics of the given dimension 
which stores int values to which you hold a *pointer*. 

If you want to access that object you have to dereference that pointer of course:

  (*lala)[2] = 8;
  cout << "lala[0]" << (*lala)[0]<< endl;
  cout << "lala[2]" << (*lala)[2]<< endl;

And don't forget to "delete" the object.

-- 
Claudio



More information about the Gcc-help mailing list