array.cpp 569 B

12345678910111213141516171819202122232425262728
  1. #include <cxxomfort/base.hpp>
  2. #include <cxxomfort/cxxo-utils.hpp>
  3. #include <cxxomfort/array.hpp>
  4. #include <cxxomfort/algorithm.hpp>
  5. #include <ctime>
  6. #include <iostream>
  7. #include <cstdlib>
  8. int main () {
  9. using namespace std;
  10. cxxomfort::output_info(stdout); cout<< endl;
  11. array<short,4> au;
  12. srand(time(0));
  13. generate(begin(au), end(au), rand);
  14. cout<< au.size()<< "\n";
  15. cout<< au.back()<< "\n";
  16. for (size_t ix=0; ix < au.size(); ++ix) {
  17. cout<< au[ix]<< " ";
  18. }
  19. cout<< endl;
  20. CXXO_FOREACH(short u, au) {
  21. cout<< u<< " ";
  22. }
  23. cout<< endl;
  24. }