码迷,mamicode.com
首页 > 编程语言 > 详细

C++中的map

时间:2020-02-14 20:25:44      阅读:57      评论:0      收藏:0      [点我收藏+]

标签:左移   ++   ble   const   table   变量   can   struct   UNC   

  • c++中的map类型变量不能为const类型
  • 示例
struct INST{
    string name;
    string type;
    string func;
};

map<string, INST> transTable = {    //can not be const
    {"000000000000",{ .name="sll", .type="R", .func="逻辑左移" }},
    {"000000000011",{ .name="sra", .type="R", .func="算术右移"  }}
};
  • 同string类型一样,map类型也有find方法,用来查找key是否存在。

C++中的map

标签:左移   ++   ble   const   table   变量   can   struct   UNC   

原文地址:https://www.cnblogs.com/friedCoder/p/12309194.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!