问题描述
struct GridProperty
{
CString Tag;
CString ObjectName;
CString ObjectType;
}
CArray<gridproperty,gridproperty> GridPropertiesArray;
一切正常.这给出了这样的结构数组:
GridPropertiesArray [0]-结构GridProperty
GridPropertiesArray [1]-结构GridProperty
..
.. etc
现在我想要一个CArray数组,如:
CarrayArray [0] --- GridPropertiesArray-GridPropertiesArray [0] struct GridProperty
-GridPropertiesArray [1] struct GridProperty
..
CarrayArray [1] --- GridPropertiesArray-GridPropertiesArray [0] struct GridProperty
-GridPropertiesArray [1] struct GridProperty
..
..
.. etc
Everything is working fine. This gives an array of structures like this:
GridPropertiesArray[0] -- struct GridProperty
GridPropertiesArray[1] -- struct GridProperty
..
.. etc
Now i want an array of CArray like:
CarrayArray[0] --- GridPropertiesArray -- GridPropertiesArray[0]struct GridProperty
-- GridPropertiesArray[1]struct GridProperty
..
CarrayArray[1] --- GridPropertiesArray -- GridPropertiesArray[0]struct GridProperty
-- GridPropertiesArray[1]struct GridProperty
..
..
.. etc
How to do this?
推荐答案
typedef CArray<gridproperty,gridproperty> GridPropertiesArray_t
CArray<GridPropertiesArray_t,GridPropertiesArray_t> GridPropertiesArrays;
GridPropertiesArrays
是您需要的对象.
注意:如果要避免typedef,如果您的编译器不完全符合C ++ 0x(或设置为c ++ 03编译),请注意在两个连续的<之间加一个空格.和>
Where GridPropertiesArrays
is the object you need.
Note: in case you want to avoid typedefs, if your compiler is not fully C++0x compliant (or set up to compile as c++03), pay attention to let a space between two consecutive < and >
这篇关于CArray数组-无法执行此操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!