可直接使用的内置数据类型 InfoOfData
Oper 模块提供了常用的内置数据类型的 InfoOfData 操作集实现,可以直接与 DList_S、ChainMap_S、OAMap_S 等单一数据类型容器配合使用,无需自行实现操作函数。
整数类型操作集
Oper/Int_Info/int_info.h
字符串类型操作集
Oper/String_Info/string_info.h
浮点数类型操作集
Oper/Double_Info/double_info.h
布尔类型操作集
Oper/Bool_Info/bool_info.h
注:一般做 value,不做 key
#include "base.h"
#include "Oper/Int_Info/int_info.h"
#include "Oper/String_Info/string_info.h"
#include "List/DList/Single_Data/dlist_sdata.h"
// 使用预定义操作集
int main() {
DList_S intList;
initSDList(&intList, &Info_Int); // 使用 Info_Int
// 插入整数
int num1 = 100, num2 = 200;
insertSDataAtEndInSDList(&intList, Data_S_OWN(&num1, NULL));
insertSDataAtEndInSDList(&intList, Data_S_OWN(&num2, NULL));
printSDList(&intList);
freeSDList(&intList);
return 0;
}
| 操作集 | 数据类型 | 推荐场景 |
|---|---|---|
Info_Int |
int | 整数数据存储、计数、索引 |
Info_String |
char* | 字符串键、文本数据 |
Info_Double |
double | 浮点数据、精确计算 |
Info_Bool |
bool | 布尔标记(建议仅做 value) |