set-begin

////////////////////////////////////////
//      2018/04/28 8:58:55
//      set-begin

// return an iterator to the first element
#include <iostream>
#include <set>
#include <iterator>

using namespace std;

int main(){
    int ary[] = { 1, 2, 3, 2, 4, 5, 7, 2, 6, 8 };
    set<int> s(ary, ary + 10);
    copy(s.begin(),s.end(), ostream_iterator<int>(cout," "));
    return 0;
}

/*
OUTPUT:
  1 2 3 4 5 6 7 8
*/
posted @ 2018-04-28 09:11  老耗子  阅读(57)  评论(0编辑  收藏  举报