fork(2) download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <iterator>
  4. #include <set>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. set<int> foo = { 1, 2, 3 };
  10.  
  11. for(auto it = begin(foo), finish = end(foo); it != finish; ++it) {
  12. foo.insert(*it * 2);
  13. }
  14.  
  15. copy(cbegin(foo), cend(foo), ostream_iterator<int>(cout, " "));
  16. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
-2147483648 -1073741824 1 2 3 4 6 8 12 16 24 32 48 64 96 128 192 256 384 512 768 1024 1536 2048 3072 4096 6144 8192 12288 16384 24576 32768 49152 65536 98304 131072 196608 262144 393216 524288 786432 1048576 1572864 2097152 3145728 4194304 6291456 8388608 12582912 16777216 25165824 33554432 50331648 67108864 100663296 134217728 201326592 268435456 402653184 536870912 805306368 1073741824 1610612736