How to iterate std::set?

前端 未结 4 1740
南方客
南方客 2020-11-30 01:37

I have this code:

std::set::iterator it;
for (it = SERVER_IPS.begin(); it != SERVER_IPS.end(); ++it) {
    u_long f = it; // error here
         


        
4条回答
  •  孤独总比滥情好
    2020-11-30 02:18

    Another example for the C++11 standard:

    set data;
    data.insert(4);
    data.insert(5);
    
    for (const int &number : data)
      cout << number;
    

提交回复
热议问题