#include <set>
#include <map>
#include <iostream>

using namespace std;

  
class CTest  
{  
private:  
    static set<int> m_set;  
    static map<int,char*> m_map;
public:  
    static void print()  
    {  
        for(set<int>::iterator iter = m_set.begin(); iter != m_set.end(); ++iter)  
            cout << *iter << endl;  
		cout<<endl;

		for(map<int,char*>::iterator iter = m_map.begin(); iter!=m_map.end(); ++iter)
			cout << iter->first <<"\t"<< iter->second << endl;
		
    }  
};  
  
set<int> initial_set()  
{  
    set<int> tmp;  
    for(int i = 0; i < 10; ++i)  
    {  
        tmp.insert(i);  
    }  
    return tmp;  
}  

map<int,char*> initial_map()
{
    map<int,char*> tmp;  
    for(int i = 0; i < 10; ++i)  
    {  	
		tmp.insert(make_pair(i,(char*)"hello"));  
    }  
    return tmp;  
}


set<int> CTest::m_set(initial_set());			// 
map<int,char*> CTest::m_map(initial_map());		//


int _tmain(int argc, _TCHAR* argv[])
{

	CTest obj;
	obj.print();


	return 0;
}


Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐