view-flat.cc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 <iomanip>
  10. #include <chrono>
  11. #include <span>
  12. using std::cout, std::endl, std::flush;
  13. namespace ra {
  14. }; // namespace ra
  15. int main()
  16. {
  17. ra::TestRecorder tr(std::cout);
  18. // TODO if dimv can be span/ptr, no need to allocate it in CellBig. But View can be standalone, so...
  19. // {
  20. // using ptr_type = std::span<ra::Dim, 2>;
  21. // ra::Big<int, 2> a({2, 3}, 0.);
  22. // ptr_type x = a.dimv;
  23. // ra::View<int, 2, ptr_type> b { x, a.data() };
  24. // cout << "b.dimv " << b.dimv << endl;
  25. // cout << "a.data() " << a.data() << endl;
  26. // cout << "b.data() " << b.data() << endl;
  27. // cout << "a " << a << endl;
  28. // cout << "b " << b << endl;
  29. // }
  30. // {
  31. // using ptr_type = ra::Ptr<decltype(std::declval<default_view::Dimv>().begin()), ra::ANY>;
  32. // ra::Big<int, 2> a({2, 3}, 0.);
  33. // ptr_type x = ra::ptr(a.dimv.begin(), 2);
  34. // cout << "x: " << x << endl;
  35. // ra::View<int, 2, ptr_type> b { x, a.data() };
  36. // cout << "b.dimv " << b.dimv << endl;
  37. // cout << "a.data() " << a.data() << endl;
  38. // cout << "b.data() " << b.data() << endl;
  39. // cout << "a " << a << endl;
  40. // cout << "b " << b << endl;
  41. // }
  42. // template <class T> struct ravel_init { T data; };
  43. // template <class T> ravel_init(T && t) -> ravel_init<T>;
  44. // template <class T> ravel_init(std::initializer_list<T> && t) -> ravel_init<std::initializer_list<T>>;
  45. return tr.summary();
  46. }