fork download
  1. import std.stdio;
  2.  
  3. void main(){
  4. int[] a = [];
  5. for(int i = 0; i < 1000000; ++i){
  6. size_t prev_cap = a.capacity();
  7. a ~= i;
  8. size_t current_cap = a.capacity();
  9. if(prev_cap != current_cap){
  10. writeln(current_cap);
  11. }
  12. }
  13. }
  14.  
Success #stdin #stdout 0.21s 2676KB
stdin
Standard input is empty
stdout
3
7
15
31
63
127
255
511
1019
2043
4091
7163
12283
20475
32763
52219
81915
124923
190459
285691
420859
619515
899067
1048571