Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

34 строки
507 B

  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include "bucket_allocator.hpp"
  4. int main(int argc, char* argv[]) {
  5. Bucket_Allocator<int> ba(2, 1);
  6. int* a = ba.allocate();
  7. *a = 1;
  8. ba.free_object(a);
  9. int* b = ba.allocate();
  10. *b = 2;
  11. int* c = ba.allocate();
  12. *c = 3;
  13. int* d = ba.allocate();
  14. *d = 4;
  15. int* e = ba.allocate();
  16. *e = 5;
  17. int* f = ba.allocate();
  18. *f = 6;
  19. ba.for_each([](int* i){
  20. printf("%d\n", *i);
  21. });
  22. return 0;
  23. }