   MFC CMap question
  I have made a class named AA,and wanne use a CMap in the a SDI,so i declera it in the CView.I am familer with the use of the MFC,there will always some errors occur when run it.In the CView ,i wrote  CMap<int,int,AA,AA> map; But the VC60. told me something wrong,so what should i do is the correct one? BTW:in CMap<KEY, ARG_KEY, VALUE, ARG_VALUE>,what is the ARG mean? Is the ARG means &CMap<KEY, &KEY, VALUE, &VALUE>,when it is not the primave agrument? f:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(1477) : error C2664: 'SetAt' : cannot convert parameter 2 from 'class AA' to 'class AA'   No copy constructor available for class 'AA'   f:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(1566) : while compiling class-template member function 'void __thiscall CMap<int,int,class AA,class AA>:erialize(class CArchive &)'CView.cppf:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(1477) : error C2664: 'SetAt' : cannot convert parameter 2 from 'class AA' to 'class AA'   No copy constructor available for class 'AA'   f:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(1566) : while compiling class-template member function 'void __thiscall CMap<int,int,class AA,class AA>:erialize(class CArchive &)'Generating Code...Error executing cl.exe.  #if !defined(AFX_AA_H__762E515E_D200_4C43_ACDF_18303AB668BB__INCLUDED_)#define AFX_AA_H__762E515E_D200_4C43_ACDF_18303AB668BB__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000class AA : public CObject  {public: AA(); virtual ~AA();public: int a;};#endif // !defined(AFX_AA_H__762E515E_D200_4C43_ACDF_18303AB668BB__INCLUDED_) and then    
  You probably wantCMap<int,int,AA,AA &> map;orCMap<int,int,AA,const AA &> map;The arg types are the types used in the function arguments for the key and value. If a type is expensive to copy or lacks a copy constructor, then the arg types should be references so that a copy is not made by the function calls.Edit: though in the cast there is no copy constructor, then you should probably storing an AA * not an AA.   ;Quote:Original post by SiCraneYou probably wantCMap<int,int,AA,AA &> map;orCMap<int,int,AA,const AA &> map;The arg types are the types used in the function arguments for the key and value. If a type is expensive to copy or lacks a copy constructor, then the arg types should be references so that a copy is not made by the function calls.Edit: though in the cast there is no copy constructor, then you should probably storing an AA * not an AA.when i use the CMap<int,int,AA,AA*>error C2664: 'SetAt' : cannot convert parameter 2 from 'class AA' to 'class AA *'error C2664: 'SetAt' : cannot convert parameter 2 from 'class AA' to 'class AA *'and more errors occur when CMap<int,int,AA, AA & >map;error C2582: 'AA' : 'operator =' function is unavailablemust i define the operator = ?