神奇的指针
1 MAP_ST_VOID::iterator iter; 2 MAP_ST_VOID_VALUE::iterator iter_value; 3 4 MAP_ST_VOID_VALUE map_st_void_value; 5 6 MAP_ST_VOID_VALUE *p_st_void_map_value = NULL; 7 8 SNPRINTF(sErrMsg, "开始写入MAP中步骤[%d][%s]结构信息.", 9 p_st_busi_frame_cfg->ioper_step, 10 stru_void_in.sName); 11 DEBUG_BF_RUNTIME_MSGOUT(sErrMsg); 12 13 iter = p_st_void_map_in->find(p_st_busi_frame_cfg->ioper_step); 14 if (iter != p_st_void_map_in->end()) 15 { 16 //假设没有到最后一条记录 17 SNPRINTF(sErrMsg, "查找MAP中步骤[%d][%s]结构信息成功.", 18 p_st_busi_frame_cfg->ioper_step, 19 stru_void_in.sName); 20 DEBUG_BF_RUNTIME_MSGOUT(sErrMsg); 21 22 p_st_void_map_value = &(iter->second); 23 24 // map中结构体中的信息,查询对应结构体的信息 25 iter_value = p_st_void_map_value->find(stru_void_in); 26 if (iter_value != p_st_void_map_value->end()) 27 { 28 p_st_void_map_value->erase(stru_void_in); 29 } 30 31 //假设有记录了 直接在 MAP_VOID_VALUE值中加入数据 32 //这样就相当于在内存中加入了 33 p_st_void_map_value->insert(make_pair(stru_void_in, stru_void_out)); 34 } 35 else 36 { 37 SNPRINTF(sErrMsg, "查找MAP中步骤[%d][%s]结构信息失败.", 38 p_st_busi_frame_cfg->ioper_step, 39 stru_void_in.sName); 40 DEBUG_BF_RUNTIME_MSGOUT(sErrMsg); 41 42 map_st_void_value.insert(make_pair(stru_void_in, stru_void_out)); 43 44 p_st_void_map_in->insert(make_pair(p_st_busi_frame_cfg->ioper_step, map_st_void_value)); 45
这一段代码的Insert很好的运用了指针指向地址 ,然后 在内存中加东西即可。

浙公网安备 33010602011771号