Author:DriverMonkey
Mail:[email protected]
Phone:13410905075
QQ:196568501
#include <string.h> #include <iostream> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <map> using namespace std; class a_t { public: const static map <int, int> test_map; }; const map <int, int> a_t::test_map = { map<int, int>::value_type(1,2), map<int, int>::value_type(2,3), map<int, int>::value_type(3,4), map<int, int>::value_type(5,6), }; int main(void) { for(auto it = a_t::test_map.begin(); it != a_t::test_map.end();it++) { cout<<"test_map.key = "<<it->first<<endl; } a_t::test_map; }
const map 成员变量初始化例子,码迷,mamicode.com
时间: 2024-10-09 11:13:21