view-flat.cc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // -*- mode: c++; coding: utf-8 -*-
  2. // ek/box - Can I do View<Iota>, what does it look like?
  3. // (c) Daniel Llorens - 2023
  4. // This library is free software; you can redistribute it and/or modify it under
  5. // the terms of the GNU Lesser General Public License as published by the Free
  6. // Software Foundation; either version 3 of the License, or (at your option) any
  7. // later version.
  8. #include "ra/test.hh"
  9. #include "ra/mpdebug.hh"
  10. #include <iomanip>
  11. #include <chrono>
  12. #include <span>
  13. using std::cout, std::endl, std::flush;
  14. namespace ra {
  15. }; // namespace ra
  16. int main()
  17. {
  18. ra::TestRecorder tr(std::cout);
  19. // TODO if dimv can be span/ptr, no need to allocate it in CellBig. But View can be standalone, so...
  20. // {
  21. // using ptr_type = std::span<ra::Dim, 2>;
  22. // ra::Big<int, 2> a({2, 3}, 0.);
  23. // ptr_type x = a.dimv;
  24. // ra::View<int, 2, ptr_type> b { x, a.data() };
  25. // cout << "b.dimv " << b.dimv << endl;
  26. // cout << "a.data() " << a.data() << endl;
  27. // cout << "b.data() " << b.data() << endl;
  28. // cout << "a " << a << endl;
  29. // cout << "b " << b << endl;
  30. // }
  31. // {
  32. // using ptr_type = ra::Ptr<decltype(std::declval<default_view::Dimv>().begin()), ra::ANY>;
  33. // ra::Big<int, 2> a({2, 3}, 0.);
  34. // ptr_type x = ra::ptr(a.dimv.begin(), 2);
  35. // cout << "x: " << x << endl;
  36. // ra::View<int, 2, ptr_type> b { x, a.data() };
  37. // cout << "b.dimv " << b.dimv << endl;
  38. // cout << "a.data() " << a.data() << endl;
  39. // cout << "b.data() " << b.data() << endl;
  40. // cout << "a " << a << endl;
  41. // cout << "b " << b << endl;
  42. // }
  43. // template <class T> struct ravel_init { T data; };
  44. // template <class T> ravel_init(T && t) -> ravel_init<T>;
  45. // template <class T> ravel_init(std::initializer_list<T> && t) -> ravel_init<std::initializer_list<T>>;
  46. return tr.summary();
  47. }