定义二维结构体常量数组
2010-07-12 15:17
351 查看
Implementation goes this way:
type
TSampleEnumType = (seNone, seONE, seTWO, seTHREE, seFOUR);
TSampleRecord = record
SampEType: TSampleEnumType;
iValue: integer;
end;
const
TConstArrayofRecord: array [0..4] TSampleRecord (
(SampEType: seNONE; iValue: 0),
(SampEType: seONE; iValue: 1),
(SampEType: seTWO; iValue: 2),
(SampEType: seTHREE; iValue: 3),
(SampEType: seFOUR; iValue: 4),
);
This can be very usefull when we require to maintain a constant table of mapped values.
I located the method from SysUtils.pas where type ExceptMap is a array of record TExceptRec.
type
TSampleEnumType = (seNone, seONE, seTWO, seTHREE, seFOUR);
TSampleRecord = record
SampEType: TSampleEnumType;
iValue: integer;
end;
const
TConstArrayofRecord: array [0..4] TSampleRecord (
(SampEType: seNONE; iValue: 0),
(SampEType: seONE; iValue: 1),
(SampEType: seTWO; iValue: 2),
(SampEType: seTHREE; iValue: 3),
(SampEType: seFOUR; iValue: 4),
);
This can be very usefull when we require to maintain a constant table of mapped values.
I located the method from SysUtils.pas where type ExceptMap is a array of record TExceptRec.
相关文章推荐
- 定义二维结构体常量数组
- 用数组常量定义数组变量
- PHP中定义数组常量(array常量)的方法
- C#基础知识(五)——常量、枚举、结构体、数组
- 定义一个结构体变量(包括年、月、日),编写程序,要求输入年月日,程序能够计算并输出改日是本年中的第几天。注意闰年问题。(数组)
- 在结构体最后定义一个长度为0的字符数组
- 在结构体最后定义一个长度为0的字符数组(技巧)
- 用unity来写 二维数组编写程序定义一个二维数组arr,该数组一共有4行3列,如下表所示,请把下表中的所有对应数据利用赋值语句赋值到该二维数组arr中去arr 第0列第1列第2列第0行第1行第2行第
- php如何定义一个常量数组
- 结构体中最后一个成员数组定义0个元素的意义
- ADS1.2不支持用CONST定义的常量作为数组长度
- c语言 数组定义 符号常量定义
- 二维动态数组定义及二维静态数组与**P的区别
- Java学习之二维数组定义与内存分配详解
- 在结构体最后定义一个长度为0的字符数组(技巧)
- js之二维数组定义和初始化三种方法
- PHP中的标量是什么?定义的常量能够是数组吗?
- VC++中全局变量、全局常量、全局结构体的定义
- c++ 二维结构体数组定义
- 在结构体中定义长度为0的数组的用法