View Single Post
  #5 (permalink)  
Old 03-27-2007, 03:10 PM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: VC++ Tips & Tricks

Hi,

I have given the technique to use array in Visual C++ below. Hope it is useful for you.

Array Declaration

// example of 2 dimensional array
typedef CArrayEx CIntArray;
CArrayEx<CIntArray, CIntArray &> a2D;
CIntArray aInt;

a2D.Add (aInt);


// auto_ptr example.
CArray<AUTO_PTR,auto_ptr<CValue> > a;
CArray<AUTO_PTR,auto_ptr<CValue> > b;

TRACE(_T("Create\n"));

a.Add(auto_ptr<CValue>(new CValue(1)));
a.Add(auto_ptr<CValue>(new CMyValue(2)));

b.Add(auto_ptr<CValue>(new CValue(3)));
b.Add(auto_ptr<CValue>(new CMyValue(4)));

// TRACE(_T("Copy\n"));
// a.Copy(b);

TRACE(_T("Append\n"));
a.Append(b);

TRACE(_T("Remove all\n"));
b.RemoveAll();



thanks
__________________
Karpagarajan. R
Necessity is the mother of invention

Last edited by Booom : 08-09-2007 at 04:38 AM.
Reply With Quote