I am bad in MFC, but I know, that it's better to use constant reference to the type as the second template argument in MFC collections, such as CArray. So, try this:
1 2 3 4 5 6 7 8 9 10
struct M{
CString a;
CString b;
CArray <CString> c; // second default argument is const T&
};
// ...
CArray <M> d; // second default argument is const T&
struct Met{
CString a;
CString b;
CArray<CString,CString&> c;
voidoperator=(const Met& m){}
};
class M{
public:
CArray<Met,Met&> d;
};
If someone knows a better way of declaring CArrays with Structs pls let me know thanks
Is not working properly, someone may be able to see the mistake?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Header:struct Met{
CString a;
CString b;
CArray <CString,CString&> c;// second default argument is const T&
voidoperator=(const Met& m){}
};
class metS{
public:
CArray <Met,Met&> d;
1 2 3 4 5
Class:
metS m_Met;
Met auxM;
... //auxM Filled; (Gets data properly)
m_Met.d.Add(auxM);
The problem im having at the moment... is that when using the function ".Add" from CArray. It increases the size of the CArray<Met,Met&> d. But inside there is nothing. It insert empty elements instead of the auxM(Which is filled with data).